src/share/classes/com/sun/tools/javac/util/List.java

changeset 1550
1df20330f6bd
parent 1442
fcf89720ae71
child 1755
ddb4a2bfcd82
equal deleted inserted replaced
1549:de932285124c 1550:1df20330f6bd
94 } 94 }
95 } 95 }
96 return res.reverse(); 96 return res.reverse();
97 } 97 }
98 98
99 public List<A> intersect(List<A> that) {
100 ListBuffer<A> buf = ListBuffer.lb();
101 for (A el : this) {
102 if (that.contains(el)) {
103 buf.append(el);
104 }
105 }
106 return buf.toList();
107 }
108
109 public List<A> diff(List<A> that) {
110 ListBuffer<A> buf = ListBuffer.lb();
111 for (A el : this) {
112 if (!that.contains(el)) {
113 buf.append(el);
114 }
115 }
116 return buf.toList();
117 }
118
99 /** Construct a list consisting of given element. 119 /** Construct a list consisting of given element.
100 */ 120 */
101 public static <A> List<A> of(A x1) { 121 public static <A> List<A> of(A x1) {
102 return new List<A>(x1, List.<A>nil()); 122 return new List<A>(x1, List.<A>nil());
103 } 123 }

mercurial