Class CollectionUtils
- java.lang.Object
-
- ai.timefold.solver.core.impl.util.CollectionUtils
-
public final class CollectionUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<T>concat(List<T> left, List<T> right)static <E> List<E>copy(List<E> originalList, boolean reverse)Creates a copy of the list, optionally in reverse order.static <K,V>
Map<K,V>newHashMap(int size)static <T> Set<T>newHashSet(int size)static <K,V>
Map<K,V>newIdentityHashMap(int size)static <K,V>
Map<K,V>newLinkedHashMap(int size)static <T> Set<T>newLinkedHashSet(int size)static <T> List<T>toDistinctList(Collection<T> collection)
-
-
-
Method Detail
-
copy
public static <E> List<E> copy(List<E> originalList, boolean reverse)
Creates a copy of the list, optionally in reverse order.- Type Parameters:
E- the type of elements in the list- Parameters:
originalList- the list to copy, preferablyArrayListreverse- true if the resulting list should have its order reversed- Returns:
- mutable list, never null
-
toDistinctList
public static <T> List<T> toDistinctList(Collection<T> collection)
-
newHashSet
public static <T> Set<T> newHashSet(int size)
-
newLinkedHashSet
public static <T> Set<T> newLinkedHashSet(int size)
-
newHashMap
public static <K,V> Map<K,V> newHashMap(int size)
-
newIdentityHashMap
public static <K,V> Map<K,V> newIdentityHashMap(int size)
-
newLinkedHashMap
public static <K,V> Map<K,V> newLinkedHashMap(int size)
-
-