重写subList

public class ContainerUtils {

public static <T> List<T> createList() {
return new ArrayList<T>();
}

public static <T> List<T> subList(List<T> origin, int fromIndex, int toIndex) {
List<T> dist = createList();

if (fromIndex >= toIndex) {
return dist;
}

for (int i = fromIndex; i < toIndex; i++) {
dist.add(origin.get(i));
}
return dist;
}
}

你可能感兴趣的:(企业应用)