Package com.helger.commons.collection
Class CollectionHelper
java.lang.Object
com.helger.commons.collection.CollectionHelper
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic <ELEMENTTYPE>
booleancontains(Collection<? extends ELEMENTTYPE> aCollection, ELEMENTTYPE aSearch) static <ELEMENTTYPE>
booleancontainsAny(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) static booleancontainsAnyNullElement(Iterable<?> aCont) Check if the passed collection contains at least onenullelement.static <ELEMENTTYPE>
booleancontainsNone(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) static <ELEMENTTYPE>
booleancontainsOnly(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) Check if the passed collection contains only elements matching the predicate.static booleancontainsOnlyNullElements(Iterable<?> aCont) Check if the passed collection contains onlynullelement.static <ELEMENTTYPE>
voidfindAll(Iterable<? extends ELEMENTTYPE> aSrc, Predicate<? super ELEMENTTYPE> aFilter, Consumer<? super ELEMENTTYPE> aConsumer) static <SRCTYPE,DSTTYPE>
voidfindAllMapped(Iterable<? extends SRCTYPE> aSrc, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, Consumer<? super DSTTYPE> aConsumer) static <SRCTYPE,DSTTYPE>
voidfindAllMapped(Iterable<? extends SRCTYPE> aSrc, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, Predicate<? super DSTTYPE> aFilter, Consumer<? super DSTTYPE> aConsumer) Iterate, map, filter, add.static <SRCTYPE,DSTTYPE>
voidfindAllMapped(Iterable<? extends SRCTYPE> aSrc, Predicate<? super SRCTYPE> aFilter, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, Consumer<? super DSTTYPE> aConsumer) Iterate, filter, map, add.static <ELEMENTTYPE>
ELEMENTTYPEstatic <ELEMENTTYPE>
ELEMENTTYPEfindFirst(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter, ELEMENTTYPE aDefault) static <ELEMENTTYPE,DSTTYPE>
DSTTYPEfindFirstMapped(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter, Function<? super ELEMENTTYPE, DSTTYPE> aMapper) static <ELEMENTTYPE,DSTTYPE>
DSTTYPEfindFirstMapped(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter, Function<? super ELEMENTTYPE, DSTTYPE> aMapper, DSTTYPE aDefault) static CommonsArrayList<?> Get the passed object as aCommonsArrayListobject.static <ELEMENTTYPE>
ELEMENTTYPEgetAtIndex(Iterable<? extends ELEMENTTYPE> aCollection, int nIndex) static <ELEMENTTYPE>
ELEMENTTYPEgetAtIndex(Iterable<? extends ELEMENTTYPE> aCollection, int nIndex, ELEMENTTYPE aDefault) static <ELEMENTTYPE>
ELEMENTTYPEgetAtIndex(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter, int nIndex) static <ELEMENTTYPE>
ELEMENTTYPEgetAtIndex(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter, int nIndex, ELEMENTTYPE aDefault) static <ELEMENTTYPE>
ELEMENTTYPEgetAtIndex(List<? extends ELEMENTTYPE> aList, int nIndex) Safe list element accessor method.static <ELEMENTTYPE>
ELEMENTTYPEgetAtIndex(List<? extends ELEMENTTYPE> aList, int nIndex, ELEMENTTYPE aDefault) Safe list element accessor method.static <SRCTYPE,DSTTYPE>
DSTTYPEgetAtIndexMapped(Iterable<? extends SRCTYPE> aCollection, int nIndex, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper) static <SRCTYPE,DSTTYPE>
DSTTYPEgetAtIndexMapped(Iterable<? extends SRCTYPE> aCollection, int nIndex, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, DSTTYPE aDefault) static <SRCTYPE,DSTTYPE>
DSTTYPEgetAtIndexMapped(Iterable<? extends SRCTYPE> aCollection, Predicate<? super SRCTYPE> aFilter, int nIndex, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper) static <SRCTYPE,DSTTYPE>
DSTTYPEgetAtIndexMapped(Iterable<? extends SRCTYPE> aCollection, Predicate<? super SRCTYPE> aFilter, int nIndex, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, DSTTYPE aDefault) static ECollectionBaseTypegetCollectionBaseTypeOfClass(Class<?> aClass) static ECollectionBaseTypestatic <KEY,VALUE>
ICommonsMap<KEY, VALUE> getCombinedMap(Map<KEY, VALUE> aMap1, Map<KEY, VALUE> aMap2) Create a map that contains the combination of the other 2 maps.static <ELEMENTTYPE,COLLTYPE extends Collection<? super ELEMENTTYPE>>
COLLTYPEgetConcatenatedInline(COLLTYPE aCont, ELEMENTTYPE... aElementsToAdd) static <ELEMENTTYPE,COLLTYPE extends Collection<? super ELEMENTTYPE>>
COLLTYPEgetConcatenatedInline(COLLTYPE aCont, Collection<? extends ELEMENTTYPE> aElementsToAdd) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getConcatenatedList(ELEMENTTYPE[] aCont1, Collection<? extends ELEMENTTYPE> aCont2) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getConcatenatedList(Collection<? extends ELEMENTTYPE> aCont1, ELEMENTTYPE... aCont2) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getConcatenatedList(Collection<? extends ELEMENTTYPE> aCollection1, Collection<? extends ELEMENTTYPE> aCollection2) static <ELEMENTTYPE>
ICommonsSet<ELEMENTTYPE> getConcatenatedSet(ELEMENTTYPE[] aCont1, Collection<? extends ELEMENTTYPE> aCont2) static <ELEMENTTYPE>
ICommonsSet<ELEMENTTYPE> getConcatenatedSet(Collection<? extends ELEMENTTYPE> aCont1, ELEMENTTYPE... aCont2) static <ELEMENTTYPE>
ICommonsSet<ELEMENTTYPE> getConcatenatedSet(Collection<? extends ELEMENTTYPE> aCont1, Collection<? extends ELEMENTTYPE> aCont2) static <ELEMENTTYPE>
intCount the number of elements in the passed iterable (collection) matching the provided filter.static <ELEMENTTYPE>
intgetCount(Collection<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) Count the number of elements in the passed collection matching the provided filter.static <ELEMENTTYPE>
ICommonsSet<ELEMENTTYPE> getDifference(Collection<? extends ELEMENTTYPE> aCollection1, Collection<? extends ELEMENTTYPE> aCollection2) Get all elements that are only contained in the first contained, and not in the second.static <KEY,VALUE>
ICommonsMap<KEY, VALUE> getFilteredMap(ICommonsMap<KEY, VALUE> aValues, Collection<? extends KEY> aKeys) Get a map consisting only of a set of specified keys.static <ELEMENTTYPE>
ELEMENTTYPEgetFirstElement(Iterable<? extends ELEMENTTYPE> aIterable, ELEMENTTYPE aDefault) Get the first element of the passed iterable.static <ELEMENTTYPE>
ELEMENTTYPEgetFirstElement(Iterable<ELEMENTTYPE> aIterable) Get the first element of the passed iterable.static <ELEMENTTYPE>
ELEMENTTYPEgetFirstElement(Collection<ELEMENTTYPE> aCollection) Get the first element of the passed collection.static <ELEMENTTYPE>
ELEMENTTYPEgetFirstElement(List<ELEMENTTYPE> aList) Get the first element of the passed list.static <ELEMENTTYPE>
ICommonsSet<ELEMENTTYPE> getIntersected(Collection<? extends ELEMENTTYPE> aCollection1, Collection<? extends ELEMENTTYPE> aCollection2) Get all elements that are contained in the first AND in the second container.static <ELEMENTTYPE>
ELEMENTTYPEgetLastElement(Iterable<ELEMENTTYPE> aIterable) static <ELEMENTTYPE>
ELEMENTTYPEgetLastElement(Collection<ELEMENTTYPE> aCollection) static <ELEMENTTYPE>
ELEMENTTYPEgetLastElement(List<ELEMENTTYPE> aList) static <ELEMENTTYPE,LISTTYPE extends List<ELEMENTTYPE>>
LISTTYPEgetReverseInlineList(LISTTYPE aList) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getReverseList(Collection<? extends ELEMENTTYPE> aCollection) static intRetrieve the size of the passedIterable.static intgetSize(Collection<?> aCollection) Retrieve the size of the passedCollection.static intgetSize(Enumeration<?> aEnumeration) Retrieve the size of the passedEnumeration.static intRetrieve the size of the passedMap.static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsArrayList<ELEMENTTYPE> getSorted(IIterableIterator<? extends ELEMENTTYPE> aIter) Convert the given iterator to a sorted list.static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsArrayList<ELEMENTTYPE> getSorted(IIterableIterator<? extends ELEMENTTYPE> aIter, Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterator to a sorted list.static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsArrayList<ELEMENTTYPE> getSorted(ELEMENTTYPE... aCont) Convert the given iterable object to a sorted list.static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getSorted(ELEMENTTYPE[] aCont, Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterable object to a sorted list.static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsArrayList<ELEMENTTYPE> Convert the given iterable object to a sorted list.static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getSorted(Iterable<? extends ELEMENTTYPE> aCont, Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterable object to a sorted list.static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsArrayList<ELEMENTTYPE> getSorted(Collection<? extends ELEMENTTYPE> aCont) Convert the given collection object to a sorted list.static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getSorted(Collection<? extends ELEMENTTYPE> aCont, Comparator<? super ELEMENTTYPE> aComparator) Convert the given collection object to a sorted list.static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsArrayList<ELEMENTTYPE> Convert the given iterator to a sorted list.static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getSorted(Iterator<? extends ELEMENTTYPE> aIter, Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterator to a sorted list.static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
ICommonsOrderedMap<KEYTYPE, VALUETYPE> getSortedByKey(Map<KEYTYPE, VALUETYPE> aMap) Get a map sorted by aIter's keys.static <KEYTYPE,VALUETYPE>
ICommonsOrderedMap<KEYTYPE, VALUETYPE> getSortedByKey(Map<KEYTYPE, VALUETYPE> aMap, Comparator<? super KEYTYPE> aKeyComparator) Get a map sorted by its keys.static <KEYTYPE,VALUETYPE extends Comparable<? super VALUETYPE>>
ICommonsOrderedMap<KEYTYPE, VALUETYPE> getSortedByValue(Map<KEYTYPE, VALUETYPE> aMap) Get a map sorted by its values.static <KEYTYPE,VALUETYPE>
ICommonsOrderedMap<KEYTYPE, VALUETYPE> getSortedByValue(Map<KEYTYPE, VALUETYPE> aMap, Comparator<? super VALUETYPE> aValueComparator) Get a map sorted by aIter's values.static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>,LISTTYPE extends List<ELEMENTTYPE>>
LISTTYPEgetSortedInline(LISTTYPE aList) static <ELEMENTTYPE,LISTTYPE extends List<ELEMENTTYPE>>
LISTTYPEgetSortedInline(LISTTYPE aList, Comparator<? super ELEMENTTYPE> aComparator) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> getSubList(List<ELEMENTTYPE> aCont, int nStartIndex, int nSectionLength) Gets a sublist excerpt of the passed list.static booleanisCollectionClass(Class<?> aClass) static booleanisCollectionObject(Object aObj) static booleanstatic booleanisEmpty(Collection<?> aCont) static booleanstatic booleanisNotEmpty(Iterable<?> aCont) static booleanisNotEmpty(Collection<?> aCont) static booleanisNotEmpty(Map<?, ?> aCont) static <ELEMENTTYPE>
List<ELEMENTTYPE> makeUnmodifiable(ELEMENTTYPE... aArray) static <ELEMENTTYPE>
Collection<ELEMENTTYPE> makeUnmodifiable(Collection<ELEMENTTYPE> aCollection) static <ELEMENTTYPE>
List<ELEMENTTYPE> makeUnmodifiable(List<ELEMENTTYPE> aList) static <KEYTYPE,VALUETYPE>
Map<KEYTYPE, VALUETYPE> makeUnmodifiable(Map<KEYTYPE, VALUETYPE> aMap) static <KEYTYPE,VALUETYPE>
NavigableMap<KEYTYPE, VALUETYPE> makeUnmodifiable(NavigableMap<KEYTYPE, VALUETYPE> aNavigableMap) static <ELEMENTTYPE>
NavigableSet<ELEMENTTYPE> makeUnmodifiable(NavigableSet<ELEMENTTYPE> aNavigableSet) static <ELEMENTTYPE>
Set<ELEMENTTYPE> makeUnmodifiable(Set<ELEMENTTYPE> aSet) static <ELEMENTTYPE>
Collection<ELEMENTTYPE> makeUnmodifiableNotNull(Collection<ELEMENTTYPE> aCollection) static <ELEMENTTYPE>
List<ELEMENTTYPE> makeUnmodifiableNotNull(List<ELEMENTTYPE> aList) static <KEYTYPE,VALUETYPE>
Map<KEYTYPE, VALUETYPE> makeUnmodifiableNotNull(Map<KEYTYPE, VALUETYPE> aMap) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
NavigableMap<KEYTYPE, VALUETYPE> makeUnmodifiableNotNull(NavigableMap<KEYTYPE, VALUETYPE> aNavigableMap) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
NavigableSet<ELEMENTTYPE> makeUnmodifiableNotNull(NavigableSet<ELEMENTTYPE> aNavigableSet) static <ELEMENTTYPE>
Set<ELEMENTTYPE> makeUnmodifiableNotNull(Set<ELEMENTTYPE> aSet) newEnumSet(Class<ELEMENTTYPE> aEnumClass, ELEMENTTYPE... aValues) newEnumSet(Class<ELEMENTTYPE> aEnumClass, Collection<ELEMENTTYPE> aValues) newEnumSet(Class<ELEMENTTYPE> aEnumClass, EnumSet<ELEMENTTYPE> aValues) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList()static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList(int nInitialCapacity) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList(IIterableIterator<? extends ELEMENTTYPE> aIter) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList(ELEMENTTYPE aValue) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList(ELEMENTTYPE... aValues) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList(Collection<? extends ELEMENTTYPE> aCont) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList(Collection<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newList(Enumeration<? extends ELEMENTTYPE> aEnum) Compared toCollections.list(Enumeration)this method is more flexible in Generics parameter.static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> static <ELEMENTTYPE,DSTTYPE>
CommonsArrayList<DSTTYPE> newListMapped(Iterable<? extends ELEMENTTYPE> aIter, Function<? super ELEMENTTYPE, ? extends DSTTYPE> aMapper) static <ELEMENTTYPE,DSTTYPE>
CommonsArrayList<DSTTYPE> newListMapped(Iterable<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter, Function<? super ELEMENTTYPE, ? extends DSTTYPE> aMapper) static <SRCTYPE,DSTTYPE>
CommonsArrayList<DSTTYPE> newListMapped(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper) static <SRCTYPE,DSTTYPE>
CommonsArrayList<DSTTYPE> newListMapped(SRCTYPE[] aValues, Function<? super SRCTYPE, ? extends DSTTYPE> aMapper) static <ELEMENTTYPE>
CommonsArrayList<ELEMENTTYPE> newListPrefilled(ELEMENTTYPE aValue, int nElements) static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> newMap()static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> newMap(int nInitialCapacity) static <ELEMENTTYPE>
CommonsHashMap<ELEMENTTYPE, ELEMENTTYPE> newMap(ELEMENTTYPE... aValues) static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> newMap(Collection<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> newMap(Collection<? extends KEYTYPE> aKeys, Collection<? extends VALUETYPE> aValues) static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> newMap(Map<KEYTYPE, VALUETYPE> aMap, Predicate<? super Map.Entry<? extends KEYTYPE, ? extends VALUETYPE>> aFilter) static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> newMap(KEYTYPE[] aKeys, VALUETYPE[] aValues) static <KEYTYPE,VALUETYPE>
CommonsHashMap<KEYTYPE, VALUETYPE> newMap(KEYTYPE aKey, VALUETYPE aValue) static <SRCTYPE,DSTKEYTYPE, DSTVALUETYPE>
CommonsHashMap<DSTKEYTYPE, DSTVALUETYPE> newMapMapped(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, ? extends DSTKEYTYPE> aKeyMapper, Function<? super SRCTYPE, ? extends DSTVALUETYPE> aValueMapper) static <SRCKEYTYPE,SRCVALUETYPE, DSTKEYTYPE, DSTVALUETYPE>
CommonsHashMap<DSTKEYTYPE, DSTVALUETYPE> newMapMapped(Map<? extends SRCKEYTYPE, ? extends SRCVALUETYPE> aMap, Function<? super SRCKEYTYPE, ? extends DSTKEYTYPE> aKeyMapper, Function<? super SRCVALUETYPE, ? extends DSTVALUETYPE> aValueMapper) static CommonsArrayList<?> newObjectListFromArray(Object aValue, Class<?> aComponentType) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(int nInitialCapacity) static <ELEMENTTYPE>
CommonsLinkedHashMap<ELEMENTTYPE, ELEMENTTYPE> newOrderedMap(ELEMENTTYPE... aValues) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(Iterable<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(Collection<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(Collection<? extends KEYTYPE> aKeys, Collection<? extends VALUETYPE> aValues) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(Map<? extends KEYTYPE, ? extends VALUETYPE> aMap) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(Map<? extends KEYTYPE, ? extends VALUETYPE>[] aMaps) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(Map<KEYTYPE, VALUETYPE> aMap, Predicate<? super Map.Entry<? extends KEYTYPE, ? extends VALUETYPE>> aFilter) static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(KEYTYPE[] aKeys, VALUETYPE[] aValues) Retrieve a map that is ordered in the way the parameter arrays are passed in.static <KEYTYPE,VALUETYPE>
CommonsLinkedHashMap<KEYTYPE, VALUETYPE> newOrderedMap(KEYTYPE aKey, VALUETYPE aValue) static <SRCTYPE,DSTKEYTYPE, DSTVALUETYPE>
CommonsLinkedHashMap<DSTKEYTYPE, DSTVALUETYPE> newOrderedMapMapped(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, ? extends DSTKEYTYPE> aKeyMapper, Function<? super SRCTYPE, ? extends DSTVALUETYPE> aValueMapper) static <SRCKEYTYPE,SRCVALUETYPE, DSTKEYTYPE, DSTVALUETYPE>
CommonsLinkedHashMap<DSTKEYTYPE, DSTVALUETYPE> newOrderedMapMapped(Map<? extends SRCKEYTYPE, ? extends SRCVALUETYPE> aMap, Function<? super SRCKEYTYPE, ? extends DSTKEYTYPE> aKeyMapper, Function<? super SRCVALUETYPE, ? extends DSTVALUETYPE> aValueMapper) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(int nInitialCapacity) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(IIterableIterator<? extends ELEMENTTYPE> aIter) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(ELEMENTTYPE aValue) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(ELEMENTTYPE... aValues) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(Iterable<? extends ELEMENTTYPE> aCont) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(Collection<? extends ELEMENTTYPE> aCont) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(Collection<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(Enumeration<? extends ELEMENTTYPE> aEnum) static <ELEMENTTYPE>
CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(Iterator<? extends ELEMENTTYPE> aIter) static <SRCTYPE,DSTTYPE>
CommonsLinkedHashSet<DSTTYPE> newOrderedSetMapped(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, DSTTYPE> aMapper) static <SRCTYPE,DSTTYPE>
CommonsLinkedHashSet<DSTTYPE> newOrderedSetMapped(SRCTYPE[] aArray, Function<? super SRCTYPE, DSTTYPE> aMapper) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet()static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet(int nInitialCapacity) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet(IIterableIterator<? extends ELEMENTTYPE> aIter) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet(ELEMENTTYPE aValue) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet(ELEMENTTYPE... aValues) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet(Collection<? extends ELEMENTTYPE> aCont) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet(Collection<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> newSet(Enumeration<? extends ELEMENTTYPE> aEnum) static <ELEMENTTYPE>
CommonsHashSet<ELEMENTTYPE> static <SRCTYPE,DSTTYPE>
CommonsHashSet<DSTTYPE> newSetMapped(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, DSTTYPE> aMapper) static <SRCTYPE,DSTTYPE>
CommonsHashSet<DSTTYPE> newSetMapped(SRCTYPE[] aArray, Function<? super SRCTYPE, DSTTYPE> aMapper) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeMap<ELEMENTTYPE, ELEMENTTYPE> newSortedMap(ELEMENTTYPE... aValues) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(Iterable<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(Collection<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(Collection<? extends KEYTYPE> aKeys, Collection<? extends VALUETYPE> aValues) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(Map<? extends KEYTYPE, ? extends VALUETYPE> aMap) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(Map<? extends KEYTYPE, ? extends VALUETYPE>[] aMaps) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(Map<KEYTYPE, VALUETYPE> aMap, Predicate<? super Map.Entry<? extends KEYTYPE, ? extends VALUETYPE>> aFilter) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(KEYTYPE[] aKeys, VALUETYPE[] aValues) static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE>
CommonsTreeMap<KEYTYPE, VALUETYPE> newSortedMap(KEYTYPE aKey, VALUETYPE aValue) static <SRCKEYTYPE,SRCVALUETYPE, DSTKEYTYPE extends Comparable<? super DSTKEYTYPE>, DSTVALUETYPE>
CommonsTreeMap<DSTKEYTYPE, DSTVALUETYPE> newSortedMapMapped(Map<? extends SRCKEYTYPE, ? extends SRCVALUETYPE> aMap, Function<? super SRCKEYTYPE, DSTKEYTYPE> aKeyMapper, Function<? super SRCVALUETYPE, DSTVALUETYPE> aValueMapper) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(IIterableIterator<? extends ELEMENTTYPE> aIter) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(ELEMENTTYPE aValue) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(ELEMENTTYPE... aValues) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(Iterable<? extends ELEMENTTYPE> aCont) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(Collection<? extends ELEMENTTYPE> aCont) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(Collection<? extends ELEMENTTYPE> aCollection, Predicate<? super ELEMENTTYPE> aFilter) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(Enumeration<? extends ELEMENTTYPE> aEnum) static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>>
CommonsTreeSet<ELEMENTTYPE> newSortedSet(Iterator<? extends ELEMENTTYPE> aIter) static <SRCTYPE,DSTTYPE extends Comparable<? super DSTTYPE>>
CommonsTreeSet<DSTTYPE> newSortedSetMapped(Collection<? extends SRCTYPE> aCollection, Function<? super SRCTYPE, DSTTYPE> aMapper) static <SRCTYPE,DSTTYPE extends Comparable<? super DSTTYPE>>
CommonsTreeSet<DSTTYPE> newSortedSetMapped(SRCTYPE[] aArray, Function<? super SRCTYPE, DSTTYPE> aMapper) static <ELEMENTTYPE>
ELEMENTTYPEremoveAndReturnElementAtIndex(List<ELEMENTTYPE> aList, int nIndex) Remove the element at the specified index from the passed list.static EChangeremoveAtIndex(List<?> aList, int nIndex) Remove the element at the specified index from the passed list.static <ELEMENTTYPE>
ELEMENTTYPEremoveFirstElement(List<ELEMENTTYPE> aList) static <ELEMENTTYPE>
ELEMENTTYPEremoveLastElement(List<ELEMENTTYPE> aList)
-
Method Details
-
getCollectionBaseTypeOfClass
-
getCollectionBaseTypeOfObject
-
isCollectionClass
-
isCollectionObject
-
getAsList
Get the passed object as aCommonsArrayListobject. This is helpful in case you want to compare the String array ["a", "b"] with the List<String> ("a", "b") If the passed object is not a recognized. container type, than a new list with one element is created!- Parameters:
aObj- The object to be converted. May not benull.- Returns:
- The object as a collection. Never
null.
-
makeUnmodifiable
@SafeVarargs @Nullable @ReturnsImmutableObject @CodingStyleguideUnaware public static <ELEMENTTYPE> List<ELEMENTTYPE> makeUnmodifiable(@Nullable ELEMENTTYPE... aArray) -
makeUnmodifiable
@Nullable @ReturnsImmutableObject @CodingStyleguideUnaware public static <ELEMENTTYPE> Collection<ELEMENTTYPE> makeUnmodifiable(@Nullable Collection<ELEMENTTYPE> aCollection) -
makeUnmodifiable
@Nullable @ReturnsImmutableObject @CodingStyleguideUnaware public static <ELEMENTTYPE> List<ELEMENTTYPE> makeUnmodifiable(@Nullable List<ELEMENTTYPE> aList) -
makeUnmodifiable
@Nullable @ReturnsImmutableObject @CodingStyleguideUnaware public static <ELEMENTTYPE> Set<ELEMENTTYPE> makeUnmodifiable(@Nullable Set<ELEMENTTYPE> aSet) -
makeUnmodifiable
@Nullable @ReturnsImmutableObject @CodingStyleguideUnaware public static <KEYTYPE,VALUETYPE> Map<KEYTYPE,VALUETYPE> makeUnmodifiable(@Nullable Map<KEYTYPE, VALUETYPE> aMap) -
makeUnmodifiableNotNull
@Nonnull @ReturnsImmutableObject @CodingStyleguideUnaware public static <ELEMENTTYPE> Collection<ELEMENTTYPE> makeUnmodifiableNotNull(@Nullable Collection<ELEMENTTYPE> aCollection) -
makeUnmodifiableNotNull
@Nonnull @ReturnsImmutableObject @CodingStyleguideUnaware public static <ELEMENTTYPE> List<ELEMENTTYPE> makeUnmodifiableNotNull(@Nullable List<ELEMENTTYPE> aList) -
makeUnmodifiableNotNull
@Nonnull @ReturnsImmutableObject @CodingStyleguideUnaware public static <ELEMENTTYPE> Set<ELEMENTTYPE> makeUnmodifiableNotNull(@Nullable Set<ELEMENTTYPE> aSet) -
makeUnmodifiableNotNull
@Nonnull @ReturnsImmutableObject @CodingStyleguideUnaware public static <KEYTYPE,VALUETYPE> Map<KEYTYPE,VALUETYPE> makeUnmodifiableNotNull(@Nullable Map<KEYTYPE, VALUETYPE> aMap) -
getDifference
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ICommonsSet<ELEMENTTYPE> getDifference(@Nullable Collection<? extends ELEMENTTYPE> aCollection1, @Nullable Collection<? extends ELEMENTTYPE> aCollection2) Get all elements that are only contained in the first contained, and not in the second. This method implementsaCont1 - aCont2.- Type Parameters:
ELEMENTTYPE- Set element type- Parameters:
aCollection1- The first container. May benullor empty.aCollection2- The second container. May benullor empty.- Returns:
- The difference and never
null. Returns an empty set, if the first container is empty. Returns a copy of the first container, if the second container is empty. ReturnsaCont1 - aCont2if both containers are non-empty.
-
getIntersected
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ICommonsSet<ELEMENTTYPE> getIntersected(@Nullable Collection<? extends ELEMENTTYPE> aCollection1, @Nullable Collection<? extends ELEMENTTYPE> aCollection2) Get all elements that are contained in the first AND in the second container.- Type Parameters:
ELEMENTTYPE- Collection element type- Parameters:
aCollection1- The first container. May benullor empty.aCollection2- The second container. May benullor empty.- Returns:
- An empty set, if either the first or the second container are
empty. Returns a set of elements that are contained in both
containers, if both containers are non-empty. The return value is
never
null.
-
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nonnegative int nInitialCapacity) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap() -
newMapMapped
@Nonnull @ReturnsMutableCopy public static <SRCKEYTYPE,SRCVALUETYPE, CommonsHashMap<DSTKEYTYPE,DSTKEYTYPE, DSTVALUETYPE> DSTVALUETYPE> newMapMapped(@Nullable Map<? extends SRCKEYTYPE, ? extends SRCVALUETYPE> aMap, @Nonnull Function<? super SRCKEYTYPE, ? extends DSTKEYTYPE> aKeyMapper, @Nonnull Function<? super SRCVALUETYPE, ? extends DSTVALUETYPE> aValueMapper) -
newMapMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTKEYTYPE, CommonsHashMap<DSTKEYTYPE,DSTVALUETYPE> DSTVALUETYPE> newMapMapped(@Nullable Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, ? extends DSTKEYTYPE> aKeyMapper, @Nonnull Function<? super SRCTYPE, ? extends DSTVALUETYPE> aValueMapper) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable Map<KEYTYPE, VALUETYPE> aMap, @Nonnull Predicate<? super Map.Entry<? extends KEYTYPE, ? extends VALUETYPE>> aFilter) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable KEYTYPE aKey, @Nullable VALUETYPE aValue) -
newMap
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> CommonsHashMap<ELEMENTTYPE,ELEMENTTYPE> newMap(@Nullable ELEMENTTYPE... aValues) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable KEYTYPE[] aKeys, @Nullable VALUETYPE[] aValues) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable Collection<? extends KEYTYPE> aKeys, @Nullable Collection<? extends VALUETYPE> aValues) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable Map<? extends KEYTYPE, ? extends VALUETYPE> aMap) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable Map<? extends KEYTYPE, ? extends VALUETYPE>[] aMaps) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable Collection<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) -
newMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsHashMap<KEYTYPE,VALUETYPE> newMap(@Nullable Iterable<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nonnegative int nInitialCapacity) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap() -
newOrderedMapMapped
@Nonnull @ReturnsMutableCopy public static <SRCKEYTYPE,SRCVALUETYPE, CommonsLinkedHashMap<DSTKEYTYPE,DSTKEYTYPE, DSTVALUETYPE> DSTVALUETYPE> newOrderedMapMapped(@Nullable Map<? extends SRCKEYTYPE, ? extends SRCVALUETYPE> aMap, @Nonnull Function<? super SRCKEYTYPE, ? extends DSTKEYTYPE> aKeyMapper, @Nonnull Function<? super SRCVALUETYPE, ? extends DSTVALUETYPE> aValueMapper) -
newOrderedMapMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTKEYTYPE, CommonsLinkedHashMap<DSTKEYTYPE,DSTVALUETYPE> DSTVALUETYPE> newOrderedMapMapped(@Nullable Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, ? extends DSTKEYTYPE> aKeyMapper, @Nonnull Function<? super SRCTYPE, ? extends DSTVALUETYPE> aValueMapper) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable Map<KEYTYPE, VALUETYPE> aMap, @Nonnull Predicate<? super Map.Entry<? extends KEYTYPE, ? extends VALUETYPE>> aFilter) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable KEYTYPE aKey, @Nullable VALUETYPE aValue) -
newOrderedMap
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> CommonsLinkedHashMap<ELEMENTTYPE,ELEMENTTYPE> newOrderedMap(@Nullable ELEMENTTYPE... aValues) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable KEYTYPE[] aKeys, @Nullable VALUETYPE[] aValues) Retrieve a map that is ordered in the way the parameter arrays are passed in. Note that key and value arrays need to have the same length.- Type Parameters:
KEYTYPE- The key type.VALUETYPE- The value type.- Parameters:
aKeys- The key array to use. May not benull.aValues- The value array to use. May not benull.- Returns:
- A
CommonsLinkedHashMapcontaining the passed key-value entries. Nevernull.
-
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable Collection<? extends KEYTYPE> aKeys, @Nullable Collection<? extends VALUETYPE> aValues) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable Map<? extends KEYTYPE, ? extends VALUETYPE> aMap) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable Map<? extends KEYTYPE, ? extends VALUETYPE>[] aMaps) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable Collection<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) -
newOrderedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> CommonsLinkedHashMap<KEYTYPE,VALUETYPE> newOrderedMap(@Nullable Iterable<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap() -
newSortedMapMapped
@Nonnull @ReturnsMutableCopy public static <SRCKEYTYPE,SRCVALUETYPE, CommonsTreeMap<DSTKEYTYPE,DSTKEYTYPE extends Comparable<? super DSTKEYTYPE>, DSTVALUETYPE> DSTVALUETYPE> newSortedMapMapped(@Nullable Map<? extends SRCKEYTYPE, ? extends SRCVALUETYPE> aMap, @Nonnull Function<? super SRCKEYTYPE, DSTKEYTYPE> aKeyMapper, @Nonnull Function<? super SRCVALUETYPE, DSTVALUETYPE> aValueMapper) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable Map<KEYTYPE, VALUETYPE> aMap, @Nonnull Predicate<? super Map.Entry<? extends KEYTYPE, ? extends VALUETYPE>> aFilter) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable KEYTYPE aKey, @Nullable VALUETYPE aValue) -
newSortedMap
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeMap<ELEMENTTYPE,ELEMENTTYPE> newSortedMap(@Nullable ELEMENTTYPE... aValues) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable KEYTYPE[] aKeys, @Nullable VALUETYPE[] aValues) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable Collection<? extends KEYTYPE> aKeys, @Nullable Collection<? extends VALUETYPE> aValues) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable Map<? extends KEYTYPE, ? extends VALUETYPE> aMap) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable Map<? extends KEYTYPE, ? extends VALUETYPE>[] aMaps) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable Collection<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) -
newSortedMap
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> CommonsTreeMap<KEYTYPE,VALUETYPE> newSortedMap(@Nullable Iterable<? extends Map.Entry<KEYTYPE, VALUETYPE>> aCollection) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nonnegative int nInitialCapacity) -
newSet
-
newSetMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> CommonsHashSet<DSTTYPE> newSetMapped(@Nullable Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newSetMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> CommonsHashSet<DSTTYPE> newSetMapped(@Nullable SRCTYPE[] aArray, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable ELEMENTTYPE aValue) -
newSet
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable ELEMENTTYPE... aValues) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable Iterable<? extends ELEMENTTYPE> aCont) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable Collection<? extends ELEMENTTYPE> aCont) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable Iterator<? extends ELEMENTTYPE> aIter) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable IIterableIterator<? extends ELEMENTTYPE> aIter) -
newSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsHashSet<ELEMENTTYPE> newSet(@Nullable Enumeration<? extends ELEMENTTYPE> aEnum) -
newEnumSet
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE extends Enum<ELEMENTTYPE>> EnumSet<ELEMENTTYPE> newEnumSet(@Nonnull Class<ELEMENTTYPE> aEnumClass, @Nullable ELEMENTTYPE... aValues) -
newEnumSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Enum<ELEMENTTYPE>> EnumSet<ELEMENTTYPE> newEnumSet(@Nonnull Class<ELEMENTTYPE> aEnumClass, @Nullable Collection<ELEMENTTYPE> aValues) -
newEnumSet
-
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet() -
newSortedSetMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE extends Comparable<? super DSTTYPE>> CommonsTreeSet<DSTTYPE> newSortedSetMapped(@Nullable Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newSortedSetMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE extends Comparable<? super DSTTYPE>> CommonsTreeSet<DSTTYPE> newSortedSetMapped(@Nullable SRCTYPE[] aArray, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) -
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable ELEMENTTYPE aValue) -
newSortedSet
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable ELEMENTTYPE... aValues) -
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable Iterable<? extends ELEMENTTYPE> aCont) -
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable Collection<? extends ELEMENTTYPE> aCont) -
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable Iterator<? extends ELEMENTTYPE> aIter) -
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable IIterableIterator<? extends ELEMENTTYPE> aIter) -
newSortedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsTreeSet<ELEMENTTYPE> newSortedSet(@Nullable Enumeration<? extends ELEMENTTYPE> aEnum) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nonnegative int nInitialCapacity) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet() -
newOrderedSetMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> CommonsLinkedHashSet<DSTTYPE> newOrderedSetMapped(@Nullable Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newOrderedSetMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> CommonsLinkedHashSet<DSTTYPE> newOrderedSetMapped(@Nullable SRCTYPE[] aArray, @Nonnull Function<? super SRCTYPE, DSTTYPE> aMapper) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nullable ELEMENTTYPE aValue) -
newOrderedSet
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nullable ELEMENTTYPE... aValues) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nullable Iterable<? extends ELEMENTTYPE> aCont) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nullable Collection<? extends ELEMENTTYPE> aCont) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nonnull Iterator<? extends ELEMENTTYPE> aIter) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nullable IIterableIterator<? extends ELEMENTTYPE> aIter) -
newOrderedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsLinkedHashSet<ELEMENTTYPE> newOrderedSet(@Nullable Enumeration<? extends ELEMENTTYPE> aEnum) -
newListPrefilled
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newListPrefilled(@Nullable ELEMENTTYPE aValue, @Nonnegative int nElements) -
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nonnegative int nInitialCapacity) -
newList
-
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) -
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable ELEMENTTYPE aValue) -
newList
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable ELEMENTTYPE... aValues) -
newListMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> CommonsArrayList<DSTTYPE> newListMapped(@Nullable SRCTYPE[] aValues, @Nonnull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper) -
newListMapped
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE,DSTTYPE> CommonsArrayList<DSTTYPE> newListMapped(@Nullable Iterable<? extends ELEMENTTYPE> aIter, @Nonnull Function<? super ELEMENTTYPE, ? extends DSTTYPE> aMapper) -
newListMapped
@Nonnull @ReturnsMutableCopy public static <SRCTYPE,DSTTYPE> CommonsArrayList<DSTTYPE> newListMapped(@Nullable Collection<? extends SRCTYPE> aCollection, @Nonnull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper) -
newListMapped
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE,DSTTYPE> CommonsArrayList<DSTTYPE> newListMapped(@Nullable Iterable<? extends ELEMENTTYPE> aCollection, @Nullable Predicate<? super ELEMENTTYPE> aFilter, @Nonnull Function<? super ELEMENTTYPE, ? extends DSTTYPE> aMapper) -
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable Enumeration<? extends ELEMENTTYPE> aEnum) Compared toCollections.list(Enumeration)this method is more flexible in Generics parameter.- Type Parameters:
ELEMENTTYPE- Type of the elements- Parameters:
aEnum- The enumeration to be converted- Returns:
- The non-
nullcreatedCommonsArrayList. - See Also:
-
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable Iterator<? extends ELEMENTTYPE> aIter) -
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable Iterable<? extends ELEMENTTYPE> aIter) -
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable Collection<? extends ELEMENTTYPE> aCont) -
newList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> newList(@Nullable IIterableIterator<? extends ELEMENTTYPE> aIter) -
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable IIterableIterator<? extends ELEMENTTYPE> aIter) Convert the given iterator to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of elements to iterate. May not benull.- Parameters:
aIter- Input iterator. May benull.- Returns:
- a non-null
CommonsArrayListbased on the results ofCollections.sort(List).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable IIterableIterator<? extends ELEMENTTYPE> aIter, @Nonnull Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterator to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of elements to iterate. May not benull.- Parameters:
aIter- Input iterator. May benull.aComparator- The comparator to use. May not benull.- Returns:
- a non-null
CommonsArrayListbased on the results ofCollections.sort(List).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable Iterator<? extends ELEMENTTYPE> aIter) Convert the given iterator to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of elements to iterate. May not benull.- Parameters:
aIter- Input iterator. May not benull.- Returns:
- a non-null
CommonsArrayListbased on the results ofCollections.sort(List).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable Iterator<? extends ELEMENTTYPE> aIter, @Nonnull Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterator to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of elements to iterate.- Parameters:
aIter- Input iterator. May benull.aComparator- The comparator to use. May not benull.- Returns:
- a non-null
CommonsArrayListbased on the results ofCollections.sort(List, Comparator).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable Iterable<? extends ELEMENTTYPE> aCont) Convert the given iterable object to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of element to iterate.- Parameters:
aCont- Iterable input object. May benull.- Returns:
- A
CommonsArrayListbased on the results ofCollections.sort(List).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable Iterable<? extends ELEMENTTYPE> aCont, @Nonnull Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterable object to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of element to iterate.- Parameters:
aCont- Iterable input object. May benull.aComparator- The comparator to use. May not benull.- Returns:
- A
CommonsArrayListbased on the results ofCollections.sort(List, Comparator).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable Collection<? extends ELEMENTTYPE> aCont) Convert the given collection object to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of element to iterate.- Parameters:
aCont- Collection input object. May benull.- Returns:
- A
CommonsArrayListbased on the results ofCollections.sort(List).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable Collection<? extends ELEMENTTYPE> aCont, @Nonnull Comparator<? super ELEMENTTYPE> aComparator) Convert the given collection object to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of element to iterate.- Parameters:
aCont- Collection input object. May benull.aComparator- The comparator to use. May not benull.- Returns:
- A
CommonsArrayListbased on the results ofCollections.sort(List, Comparator).
-
getSorted
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable ELEMENTTYPE... aCont) Convert the given iterable object to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of element to iterate.- Parameters:
aCont- Array input object. May benull.- Returns:
- A
CommonsArrayListbased on the results ofCollections.sort(List).
-
getSorted
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getSorted(@Nullable ELEMENTTYPE[] aCont, @Nonnull Comparator<? super ELEMENTTYPE> aComparator) Convert the given iterable object to a sorted list.- Type Parameters:
ELEMENTTYPE- The type of element to iterate.- Parameters:
aCont- Iterable input object. May benull.aComparator- The comparator to use. May not benull.- Returns:
- A
CommonsArrayListbased on the results ofCollections.sort(List, Comparator).
-
getSortedInline
@Nullable @ReturnsMutableObject("design") @CodingStyleguideUnaware public static <ELEMENTTYPE extends Comparable<? super ELEMENTTYPE>,LISTTYPE extends List<ELEMENTTYPE>> LISTTYPE getSortedInline(@Nullable LISTTYPE aList) -
getSortedInline
@Nullable @ReturnsMutableObject("design") @CodingStyleguideUnaware public static <ELEMENTTYPE,LISTTYPE extends List<ELEMENTTYPE>> LISTTYPE getSortedInline(@Nullable LISTTYPE aList, @Nonnull Comparator<? super ELEMENTTYPE> aComparator) -
getSortedByKey
@Nonnull @ReturnsMutableCopy public static <KEYTYPE extends Comparable<? super KEYTYPE>,VALUETYPE> ICommonsOrderedMap<KEYTYPE,VALUETYPE> getSortedByKey(@Nullable Map<KEYTYPE, VALUETYPE> aMap) Get a map sorted by aIter's keys. Because no comparator is defined, the key type needs to implement theComparableinterface.- Type Parameters:
KEYTYPE- map key typeVALUETYPE- map value type- Parameters:
aMap- the map to sort- Returns:
- the sorted map and never
null.
-
getSortedByKey
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> ICommonsOrderedMap<KEYTYPE,VALUETYPE> getSortedByKey(@Nullable Map<KEYTYPE, VALUETYPE> aMap, @Nonnull Comparator<? super KEYTYPE> aKeyComparator) Get a map sorted by its keys. The comparison order is defined by the passed comparator object.- Type Parameters:
KEYTYPE- map key typeVALUETYPE- map value type- Parameters:
aMap- The map to sort. May not benull.aKeyComparator- The comparator to be used. May not benull.- Returns:
- the sorted map and never
null.
-
getSortedByValue
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE extends Comparable<? super VALUETYPE>> ICommonsOrderedMap<KEYTYPE,VALUETYPE> getSortedByValue(@Nullable Map<KEYTYPE, VALUETYPE> aMap) Get a map sorted by its values. Because no comparator is defined, the value type needs to implement theComparableinterface.- Type Parameters:
KEYTYPE- map key typeVALUETYPE- map value type- Parameters:
aMap- The map to sort. May not benull.- Returns:
- the sorted map and never
null.
-
getSortedByValue
@Nonnull @ReturnsMutableCopy public static <KEYTYPE,VALUETYPE> ICommonsOrderedMap<KEYTYPE,VALUETYPE> getSortedByValue(@Nullable Map<KEYTYPE, VALUETYPE> aMap, @Nonnull Comparator<? super VALUETYPE> aValueComparator) Get a map sorted by aIter's values. The comparison order is defined by the passed comparator object.- Type Parameters:
KEYTYPE- map key typeVALUETYPE- map value type- Parameters:
aMap- The map to sort. May not benull.aValueComparator- The comparator to be used. May not benull.- Returns:
- the sorted map and never
null.
-
getReverseList
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getReverseList(@Nullable Collection<? extends ELEMENTTYPE> aCollection) -
getReverseInlineList
@Nullable @ReturnsMutableObject("semantics of this method") @CodingStyleguideUnaware public static <ELEMENTTYPE,LISTTYPE extends List<ELEMENTTYPE>> LISTTYPE getReverseInlineList(@Nullable LISTTYPE aList) -
getFilteredMap
@Nullable @ReturnsMutableCopy public static <KEY,VALUE> ICommonsMap<KEY,VALUE> getFilteredMap(@Nullable ICommonsMap<KEY, VALUE> aValues, @Nullable Collection<? extends KEY> aKeys) Get a map consisting only of a set of specified keys. If an element from the key set is not contained in the original map, the key is ignored.- Type Parameters:
KEY- Source map key type.VALUE- Source map value type.- Parameters:
aValues- Source map to filter. May not benull.aKeys- The filter set to filter the entries from. May not benull.- Returns:
- A non-
nullmap containing only the elements from the specified key set.
-
getFirstElement
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getFirstElement(@Nullable List<ELEMENTTYPE> aList) Get the first element of the passed list.- Type Parameters:
ELEMENTTYPE- List element type- Parameters:
aList- The list. May benull.- Returns:
nullif the list isnullor empty, the first element otherwise.
-
getFirstElement
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getFirstElement(@Nullable Collection<ELEMENTTYPE> aCollection) Get the first element of the passed collection.- Type Parameters:
ELEMENTTYPE- Collection element type- Parameters:
aCollection- The collection. May benull.- Returns:
nullif the collection isnullor empty, the first element otherwise.
-
getFirstElement
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getFirstElement(@Nullable Iterable<ELEMENTTYPE> aIterable) Get the first element of the passed iterable.- Type Parameters:
ELEMENTTYPE- Iterable element type- Parameters:
aIterable- The iterable. May benull.- Returns:
nullif the iterable isnullor empty, the first element otherwise.
-
getFirstElement
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getFirstElement(@Nullable Iterable<? extends ELEMENTTYPE> aIterable, @Nullable ELEMENTTYPE aDefault) Get the first element of the passed iterable.- Type Parameters:
ELEMENTTYPE- Iterable element type- Parameters:
aIterable- The iterable. May benull.aDefault- The default value to be returned, if no such value is present. May benull.- Returns:
nullif the iterable isnullor empty, the first element otherwise.- Since:
- 10.1.3
-
removeFirstElement
-
getLastElement
-
getLastElement
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getLastElement(@Nullable Collection<ELEMENTTYPE> aCollection) -
getLastElement
-
removeAtIndex
Remove the element at the specified index from the passed list. This works if the list is notnulland the index is ≥ 0 and <list.size()- Parameters:
aList- The list to remove an element from. May benull.nIndex- The index to be removed. May be arbitrary.- Returns:
EChange.CHANGEDif removal was successful- See Also:
-
removeAndReturnElementAtIndex
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE removeAndReturnElementAtIndex(@Nullable List<ELEMENTTYPE> aList, int nIndex) Remove the element at the specified index from the passed list. This works if the list is notnulland the index is ≥ 0 and <list.size()- Type Parameters:
ELEMENTTYPE- List element type- Parameters:
aList- The list to remove an element from. May benull.nIndex- The index to be removed. May be arbitrary.- Returns:
nullif removal failed or the removed element. Note: the removed element may also benullso it may be tricky to determine if removal succeeded or not!- See Also:
-
removeLastElement
-
isEmpty
-
isEmpty
-
isEmpty
-
isNotEmpty
-
isNotEmpty
-
isNotEmpty
-
getSize
Retrieve the size of the passedCollection. This method handlesnullcontainers.- Parameters:
aCollection- Object to check. May benull.- Returns:
- The size of the object or 0 if the passed parameter is
null.
-
getSize
Retrieve the size of the passedMap. This method handlesnullcontainers.- Parameters:
aMap- Object to check. May benull.- Returns:
- The size of the object or 0 if the passed parameter is
null.
-
getSize
Retrieve the size of the passedIterable.- Parameters:
aIterable- Iterator to check. May benull.- Returns:
- The number objects or 0 if the passed parameter is
null.
-
getSize
Retrieve the size of the passedEnumeration.- Parameters:
aEnumeration- Enumeration to check. May benull.- Returns:
- The number objects or 0 if the passed parameter is
null.
-
getConcatenatedList
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getConcatenatedList(@Nullable Collection<? extends ELEMENTTYPE> aCollection1, @Nullable Collection<? extends ELEMENTTYPE> aCollection2) -
getConcatenatedList
@Nullable @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getConcatenatedList(@Nullable Collection<? extends ELEMENTTYPE> aCont1, @Nullable ELEMENTTYPE... aCont2) -
getConcatenatedList
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getConcatenatedList(@Nullable ELEMENTTYPE[] aCont1, @Nullable Collection<? extends ELEMENTTYPE> aCont2) -
getConcatenatedSet
@Nullable @ReturnsMutableCopy public static <ELEMENTTYPE> ICommonsSet<ELEMENTTYPE> getConcatenatedSet(@Nullable Collection<? extends ELEMENTTYPE> aCont1, @Nullable Collection<? extends ELEMENTTYPE> aCont2) -
getConcatenatedSet
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> ICommonsSet<ELEMENTTYPE> getConcatenatedSet(@Nullable Collection<? extends ELEMENTTYPE> aCont1, @Nullable ELEMENTTYPE... aCont2) -
getConcatenatedSet
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ICommonsSet<ELEMENTTYPE> getConcatenatedSet(@Nullable ELEMENTTYPE[] aCont1, @Nullable Collection<? extends ELEMENTTYPE> aCont2) -
getConcatenatedInline
@Nonnull @ReturnsMutableObject("design") @SafeVarargs @CodingStyleguideUnaware public static <ELEMENTTYPE,COLLTYPE extends Collection<? super ELEMENTTYPE>> COLLTYPE getConcatenatedInline(@Nonnull COLLTYPE aCont, @Nullable ELEMENTTYPE... aElementsToAdd) -
getConcatenatedInline
@Nonnull @ReturnsMutableObject("design") @CodingStyleguideUnaware public static <ELEMENTTYPE,COLLTYPE extends Collection<? super ELEMENTTYPE>> COLLTYPE getConcatenatedInline(@Nonnull COLLTYPE aCont, @Nullable Collection<? extends ELEMENTTYPE> aElementsToAdd) -
getCombinedMap
@Nonnull @ReturnsMutableCopy public static <KEY,VALUE> ICommonsMap<KEY,VALUE> getCombinedMap(@Nullable Map<KEY, VALUE> aMap1, @Nullable Map<KEY, VALUE> aMap2) Create a map that contains the combination of the other 2 maps. Both maps need to have the same key and value type.- Type Parameters:
KEY- The map key type.VALUE- The map value type.- Parameters:
aMap1- The first map. May benull.aMap2- The second map. May benull.- Returns:
- Never
nulland always a new object. If both parameters are notnulla new map is created, initially containing the entries from the first parameter, afterwards extended by the parameters of the second map potentially overwriting elements from the first map.
-
newObjectListFromArray
@Nullable @ReturnsMutableCopy public static CommonsArrayList<?> newObjectListFromArray(@Nullable Object aValue, @Nonnull Class<?> aComponentType) -
getSubList
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList<ELEMENTTYPE> getSubList(@Nullable List<ELEMENTTYPE> aCont, @Nonnegative int nStartIndex, @Nonnegative int nSectionLength) Gets a sublist excerpt of the passed list.- Type Parameters:
ELEMENTTYPE- Type of elements in list- Parameters:
aCont- The backing list. May not benull.nStartIndex- The start index to use. Needs to be ≥ 0.nSectionLength- the length of the desired subset. If list is shorter than that, aIter will return a shorter section- Returns:
- The specified section of the passed list, or a shorter list if
nStartIndex + nSectionLength is an invalid index. Never
null.
-
contains
public static <ELEMENTTYPE> boolean contains(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nullable ELEMENTTYPE aSearch) -
findFirst
-
findFirst
-
findFirstMapped
-
findFirstMapped
-
findAll
-
findAllMapped
-
findAllMapped
public static <SRCTYPE,DSTTYPE> void findAllMapped(@Nullable Iterable<? extends SRCTYPE> aSrc, @Nullable Predicate<? super SRCTYPE> aFilter, @Nonnull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, @Nonnull Consumer<? super DSTTYPE> aConsumer) Iterate, filter, map, add.- Type Parameters:
SRCTYPE- Source object typeDSTTYPE- Destination object type- Parameters:
aSrc- Source collection. May benull.aFilter- Filter on source object to use. May benull.aMapper- Mapping function. May not benull.aConsumer- Destination consumer. May not benull.
-
findAllMapped
public static <SRCTYPE,DSTTYPE> void findAllMapped(@Nullable Iterable<? extends SRCTYPE> aSrc, @Nonnull Function<? super SRCTYPE, ? extends DSTTYPE> aMapper, @Nullable Predicate<? super DSTTYPE> aFilter, @Nonnull Consumer<? super DSTTYPE> aConsumer) Iterate, map, filter, add.- Type Parameters:
SRCTYPE- Source object typeDSTTYPE- Destination object type- Parameters:
aSrc- Source collection. May benull.aMapper- Mapping function. May not benull.aFilter- Filter on mapped object to use. May benull.aConsumer- Destination consumer. May not benull.- Since:
- 8.5.2
-
getCount
@Nonnegative public static <ELEMENTTYPE> int getCount(@Nullable Iterable<? extends ELEMENTTYPE> aCollection, @Nullable Predicate<? super ELEMENTTYPE> aFilter) Count the number of elements in the passed iterable (collection) matching the provided filter.- Type Parameters:
ELEMENTTYPE- The element type to count- Parameters:
aCollection- The collection to count. May not benull.aFilter- The filter to be applied. May benull.- Returns:
- The number of matching elements. Always ≥ 0. If no filter is
provided this is the same as
getSize(Iterable).
-
getCount
@Nonnegative public static <ELEMENTTYPE> int getCount(@Nullable Collection<? extends ELEMENTTYPE> aCollection, @Nullable Predicate<? super ELEMENTTYPE> aFilter) Count the number of elements in the passed collection matching the provided filter.- Type Parameters:
ELEMENTTYPE- The element type to count- Parameters:
aCollection- The collection to count. May not benull.aFilter- The filter to be applied. May benull.- Returns:
- The number of matching elements. Always ≥ 0. If no filter is
provided this is the same as
getSize(Collection).
-
containsAny
-
containsNone
-
containsOnly
public static <ELEMENTTYPE> boolean containsOnly(@Nullable Iterable<? extends ELEMENTTYPE> aCollection, @Nullable Predicate<? super ELEMENTTYPE> aFilter) Check if the passed collection contains only elements matching the predicate. An empty collection does not fulfill this requirement! If no filter is provided the return value is identical toisNotEmpty(Iterable)- Type Parameters:
ELEMENTTYPE- Collection data type- Parameters:
aCollection- The collection to check. May benull.aFilter- Predicate to check against all elements. May not benull.- Returns:
trueonly if the passed collection is neithernullnor empty and if only matching elements are contained, or if no filter is provided and the collection is not empty.
-
containsAnyNullElement
Check if the passed collection contains at least onenullelement.- Parameters:
aCont- The collection to check. May benull.- Returns:
trueonly if the passed collection is neithernullnor empty and if at least onenullelement is contained.
-
containsOnlyNullElements
Check if the passed collection contains onlynullelement.- Parameters:
aCont- The collection to check. May benull.- Returns:
trueonly if the passed collection is neithernullnor empty and if at least onenullelement is contained.
-
getAtIndex
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getAtIndex(@Nullable List<? extends ELEMENTTYPE> aList, int nIndex) Safe list element accessor method.- Type Parameters:
ELEMENTTYPE- The type of elements on the list.- Parameters:
aList- The list to extract from. May benull.nIndex- The index to access. Should be ≥ 0.- Returns:
nullif the element cannot be accessed.
-
getAtIndex
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getAtIndex(@Nullable List<? extends ELEMENTTYPE> aList, int nIndex, @Nullable ELEMENTTYPE aDefault) Safe list element accessor method.- Type Parameters:
ELEMENTTYPE- The type of elements on the list.- Parameters:
aList- The list to extract from. May benull.nIndex- The index to access. Should be ≥ 0.aDefault- The value to be returned, if the index is out of bounds.- Returns:
- The default parameter if the element cannot be accessed.
-
getAtIndex
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getAtIndex(@Nullable Iterable<? extends ELEMENTTYPE> aCollection, @Nonnegative int nIndex) -
getAtIndex
@Nullable public static <ELEMENTTYPE> ELEMENTTYPE getAtIndex(@Nullable Iterable<? extends ELEMENTTYPE> aCollection, @Nonnegative int nIndex, @Nullable ELEMENTTYPE aDefault) -
getAtIndex
-
getAtIndex
-
getAtIndexMapped
-
getAtIndexMapped
-
getAtIndexMapped
-
getAtIndexMapped
-