Here you can find the source of createSublist(final T[] elements, final Class extends List> listImplementation)
private static <T> List<T> createSublist(final T[] elements, final Class<? extends List> listImplementation)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.List; public class Main { private static <T> List<T> createSublist(final T[] elements, final Class<? extends List> listImplementation) { List<T> sublist;/* w w w . j ava 2 s .c o m*/ final List<T> asList = Arrays.asList(elements); try { sublist = listImplementation.newInstance(); sublist.addAll(asList); } catch (final InstantiationException e) { sublist = asList; } catch (final IllegalAccessException e) { sublist = asList; } return sublist; } }