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. |