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

changeset 1759
05ec778794d0
parent 1755
ddb4a2bfcd82
child 2000
4a6acc42c3a1
equal deleted inserted replaced
1758:bcd927639039 1759:05ec778794d0
152 xs = new List<A>(array[i], xs); 152 xs = new List<A>(array[i], xs);
153 return xs; 153 return xs;
154 } 154 }
155 155
156 public static <A> List<A> from(Iterable<? extends A> coll) { 156 public static <A> List<A> from(Iterable<? extends A> coll) {
157 List<A> xs = nil(); 157 ListBuffer<A> xs = ListBuffer.lb();
158 for (A a : coll) { 158 for (A a : coll) {
159 xs = new List<A>(a, xs); 159 xs.append(a);
160 } 160 }
161 return xs; 161 return xs.toList();
162 } 162 }
163 163
164 /** Construct a list consisting of a given number of identical elements. 164 /** Construct a list consisting of a given number of identical elements.
165 * @param len The number of elements in the list. 165 * @param len The number of elements in the list.
166 * @param init The value of each element. 166 * @param init The value of each element.

mercurial