List of usage examples for java.util List addAll
boolean addAll(Collection<? extends E> c);
From source file:Main.java
public static <T> List<T> addAll(List<T> listeDestination, List<T> listeAInserer) { if (listeDestination == null && listeAInserer == null) { return new ArrayList<T>(); }/*from w ww. ja va 2 s . c o m*/ if (listeDestination == null && listeAInserer != null) { return new ArrayList<T>(listeAInserer); } if (listeDestination != null && listeAInserer == null) { return new ArrayList<T>(listeDestination); } final List<T> listeRetour = new ArrayList<T>(listeDestination); listeRetour.addAll(listeAInserer); return listeRetour; }
From source file:Main.java
public static <T> List<T> prepend(final T value, final List<T> list) { final List<T> values = new ArrayList<T>(); values.add(value);// w ww . j a v a2 s . c om values.addAll(list); return values; }
From source file:Main.java
private static void addToList(List<Uri> arrayList, List<Uri> arrayList2) { if (arrayList != null && arrayList.size() > 0) { arrayList2.addAll(arrayList); }/* www. j ava2 s . c o m*/ }
From source file:Main.java
public static <T> List<T> createListFromList(Collection<T> collection) { List<T> newList = new ArrayList<T>(); if (collection != null) { newList.addAll(collection); }/*from www .j a v a 2s . c om*/ return newList; }
From source file:Main.java
private static List<String> filterParamNamesWithObjectValue(Map<String, Object> paramValueMap, List<String> ignoreParamNameList) { List<String> filteredParamNames = new ArrayList<>(paramValueMap.size()); filteredParamNames.addAll(paramValueMap.keySet()); if (ignoreParamNameList != null && ignoreParamNameList.size() > 0) { for (String ignoreParamName : ignoreParamNameList) { filteredParamNames.remove(ignoreParamName); }/*from w ww. j a va2 s . co m*/ } return filteredParamNames; }
From source file:Main.java
public static <K, V> void findInMultimap(Map<K, List<V>> map, K key, List<V> result) { List<V> tmp = map.get(key); if (tmp != null) result.addAll(tmp); }
From source file:Main.java
/** * Joins all given elements in a single (flat) List. * //from w w w. j a v a2 s. com * @param element first element to include in the list * @param otherElements other elements to include in the list * @param <T> the elements type * @return a list combining all given elements */ public static <T> List<T> join(T element, List<T> otherElements) { final List<T> result = new ArrayList<>(); result.add(element); result.addAll(otherElements); return result; }
From source file:Main.java
public static <T> List<T> concatenate(Collection<? extends Collection<T>> lists) { List<T> list = new ArrayList<T>(); for (Collection<T> c : lists) { list.addAll(c); }/* w w w . j av a2 s. com*/ return list; }
From source file:Main.java
public static <T> List<T> joinListValues(Map<?, List<T>> map) { List<T> joinedValues = new ArrayList<>(); for (List<T> list : map.values()) { joinedValues.addAll(list); }/*from w ww .j a va2 s . c o m*/ return joinedValues; }
From source file:Main.java
public static <E> List<E> flatten(Collection<? extends Collection<E>> nested) { List<E> flat = new LinkedList<>(); for (Collection<E> current : nested) { flat.addAll(current); }// w w w .ja va2s. co m return flat; }