1.1 --- a/src/share/classes/com/sun/tools/javac/util/List.java Tue Feb 05 21:55:41 2013 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/util/List.java Wed Feb 06 14:03:39 2013 +0000 1.3 @@ -96,6 +96,26 @@ 1.4 return res.reverse(); 1.5 } 1.6 1.7 + public List<A> intersect(List<A> that) { 1.8 + ListBuffer<A> buf = ListBuffer.lb(); 1.9 + for (A el : this) { 1.10 + if (that.contains(el)) { 1.11 + buf.append(el); 1.12 + } 1.13 + } 1.14 + return buf.toList(); 1.15 + } 1.16 + 1.17 + public List<A> diff(List<A> that) { 1.18 + ListBuffer<A> buf = ListBuffer.lb(); 1.19 + for (A el : this) { 1.20 + if (!that.contains(el)) { 1.21 + buf.append(el); 1.22 + } 1.23 + } 1.24 + return buf.toList(); 1.25 + } 1.26 + 1.27 /** Construct a list consisting of given element. 1.28 */ 1.29 public static <A> List<A> of(A x1) {