@Test public void testTransform() throws Exception { List<String> fromList = new LinkedList<>(); fromList.add("1"); fromList.add("2"); fromList.add("3"); fromList.add("4"); List<Integer> toList = Lists.transform(fromList, Integer::parseInt); assertEquals(toList.size(), fromList.size()); System.out.println(toList); }
public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) { return (fromList instanceof RandomAccess) ? new TransformingRandomAccessList<>(fromList, function) : new TransformingSequentialList<>(fromList, function); }
Lists { public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) { return (fromList instanceof RandomAccess) ? new TransformingRandomAccessList<>(fromList, function) : new TransformingSequentialList<>(fromList, function); } }
Lists { public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) { return (fromList instanceof RandomAccess) ? new TransformingRandomAccessList<>(fromList, function) : new TransformingSequentialList<>(fromList, function); } private  Lists(); }
Lists { public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) { return (fromList instanceof RandomAccess) ? new TransformingRandomAccessList<>(fromList, function) : new TransformingSequentialList<>(fromList, function); } private  Lists(); static ArrayList<E> newArrayList(); @SuppressWarnings("unchecked") static ArrayList<E> newArrayList(E... elements); @SuppressWarnings("unchecked") static ArrayList<E> newArrayList(Iterable<? extends E> elements); static ArrayList<E> newArrayList(Iterator<? extends E> elements); static ArrayList<E> newArrayListWithCapacity(int initialArraySize); static List<T> transform(List<F> fromList, Function<? super F, ? extends T> function); }
Lists { public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) { return (fromList instanceof RandomAccess) ? new TransformingRandomAccessList<>(fromList, function) : new TransformingSequentialList<>(fromList, function); } private  Lists(); static ArrayList<E> newArrayList(); @SuppressWarnings("unchecked") static ArrayList<E> newArrayList(E... elements); @SuppressWarnings("unchecked") static ArrayList<E> newArrayList(Iterable<? extends E> elements); static ArrayList<E> newArrayList(Iterator<? extends E> elements); static ArrayList<E> newArrayListWithCapacity(int initialArraySize); static List<T> transform(List<F> fromList, Function<? super F, ? extends T> function);  }