Package org.openforis.commons.collection
Class CollectionUtils
java.lang.Object
org.openforis.commons.collection.CollectionUtils
- Author:
- M. Togna, S. Ricci
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Collection<T>addIgnoreNull(Collection<T> items, T item) static <T> List<T>Creates a clone of the specified list (NOT a DEEP CLONE of the objects inside the list)static <K,V> void cloneValuesInto(Map<K, V> fromMap, Map<K, V> intoMap) static <T> List<T>copyAndFillWith(List<T> list, int newSize, T fillValue) static <T> List<T>copyAndFillWithNulls(List<T> list, int newSize) static <T extends DeepComparable>
booleandeepEquals(Collection<T> coll1, Collection<T> coll2) static <T extends DeepComparable>
booleandeepEquals(Collection<T> coll1, Collection<T> coll2, boolean ignoreId) static <T,C extends Collection<T>>
voidstatic <T> Tfind(Collection<T> items, Predicate<T> predicate) static <T> TfindItem(Collection<T> items, Object key) static <T> TfindItem(Collection<T> items, Object key, String keyPropertyName) indexOfItems(List<T> list, Collection<T> items) static <T> Set<T>intersect(Collection<T> listA, Collection<T> listB) static booleanisNotEmpty(Collection<?> collection) static <I,T> List<I> project(Collection<T> items, String propertyName) static <T> voidShifts the item to the specified index.static <T> List<T>sublistByIndexes(List<T> source, List<Integer> indexes) static <T> Collection<T>unmodifiableCollection(Collection<? extends T> collection) static <T> List<T>unmodifiableList(List<? extends T> list) Returns an unmodifiable view of the specified list.static <K,V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> map) static <T> Set<T>unmodifiableSet(Set<? extends T> set)
-
Constructor Details
-
CollectionUtils
public CollectionUtils()
-
-
Method Details
-
unmodifiableList
Returns an unmodifiable view of the specified list.
This method makes use of the method unmodifiableList of java.util.Collections and returns an empty list if the provided list is null.- Parameters:
list-- Returns:
- See Also:
-
java.util.Collections.unmodifiableList
-
unmodifiableSet
-
unmodifiableMap
-
unmodifiableCollection
-
shiftItem
Shifts the item to the specified index. -
isNotEmpty
-
filter
-
find
-
findItem
-
findItem
-
addIgnoreNull
-
project
-
deepEquals
public static <T extends DeepComparable> boolean deepEquals(Collection<T> coll1, Collection<T> coll2) -
deepEquals
public static <T extends DeepComparable> boolean deepEquals(Collection<T> coll1, Collection<T> coll2, boolean ignoreId) -
clone
Creates a clone of the specified list (NOT a DEEP CLONE of the objects inside the list)- Parameters:
list-- Returns:
-
cloneValuesInto
-
copyAndFillWithNulls
-
copyAndFillWith
-
intersect
-
indexOfItems
-
sublistByIndexes
-