List of utility methods to do List Copy
ArrayList | copyNullSafeMutableList(Collection extends E> list) copy Null Safe Mutable List if (list == null) throw new NullPointerException("list"); ArrayList<E> result = new ArrayList<E>(list); for (E element : result) { if (element == null) throw new NullPointerException("element"); return result; ... |
List | copyObjectList(List Get a copy of a list of objects List<Object> answer = new ArrayList<Object>(); if (objects == null) return null; for (Object o : objects) { answer.add(o); return answer; |
List | copyOf(List Returns a copy of the given list. List<T> result = new ArrayList<>(list.size()); result.addAll(list); return result; |
List | copyOf(List copy Of return new ArrayList<T>(values); |
List | copyOfRange(List Returns a new list containing all elements of the original list with an index in [from;to] if (from < 0 || from >= list.size() || to < 0 || to >= list.size() || from > to) throw new IllegalArgumentException("Illegal extraction bounds"); List<T> result = new ArrayList<>(to - from + 1); for (int i = from; i <= to; i++) result.add(list.get(i)); return result; |
void | copyProbabilities(List Copy the values of target probs into destination probs for (int index = 0; index < targetProbs.size(); index++) { destinationProbs.set(index, targetProbs.get(index)); |
List | copyQueryFilters(List copy Query Filters return queryFilters != null ? new ArrayList<String>(queryFilters) : new ArrayList<String>(); |
java.util.List | copySafelyToObjectList(java.util.List> list) copy Safely To Object List java.util.Iterator<?> it = list.iterator(); java.util.List<Object> castedCopy = new java.util.ArrayList<Object>(); while (it.hasNext()) { castedCopy.add(it.next()); return castedCopy; |
ArrayList | copyStringList(List copy String List if (l1 == null) { return null; ArrayList<String> l2 = new ArrayList<String>(l1.size()); for (String str : l1) { l2.add(str); return l2; ... |
List | copyStringList(List copy String List List<String> result = new ArrayList<String>(list.size()); result.addAll(list); return result; |