集合子列表,集合列表,public class
分享于 点击 44804 次 点评:23
集合子列表,集合列表,public class
public class CollectionUtils { public static <T> ArrayList<T> getSubList(List<T> l, int offset, int length) { if (offset >= l.size()) return new ArrayList<T>(0); if (length < 0) return new ArrayList<T>(0); ArrayList<T> sl = new ArrayList<T>(length); int upper = offset + length; int bound = upper < l.size() ? upper : l.size(); for (int i = offset; i < bound; i++) sl.add(l.get(i)); return sl; }}
用户点评