Android examples for java.util:List
union two List
/*//from w w w.j a v a2 s.c o m * Copyright (c) 2016 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com> * All Rights Reserved. */ import java.util.AbstractList; import java.util.List; import java.util.RandomAccess; public class Main{ public static <E> List<E> union(List<E> list1, List<E> list2) { if (list1 instanceof RandomAccess && list2 instanceof RandomAccess) { return new RandomAccessUnionList<>(list1, list2); } else { return new UnionList<>(list1, list2); } } }