Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="CollectionsInstance") public interface CollectionsInstance
java.util.Collections
class that delegates all method calls to
the corresponding Collections
method.
Note! Method documentations in this interface are only excerpts. For full documentation, see official java.util.Collections Javadoc
An instance of the Sitevision class implementing this interface can be obtained via InstanceCreatorUtil.getCollectionsInstance()
.
See InstanceCreatorUtil
for how to obtain an instance of the InstanceCreatorUtil
interface.
Modifier and Type | Field and Description |
---|---|
static List |
EMPTY_LIST
The empty list (immutable).
|
static Map |
EMPTY_MAP
The empty map (immutable).
|
static Set |
EMPTY_SET
The empty set (immutable).
|
Modifier and Type | Method and Description |
---|---|
<T> boolean |
addAll(Collection<? super T> aCollection,
T... aValues)
Adds all of the specified elements to the specified collection.
|
<T> Queue<T> |
asLifoQueue(Deque<T> aDeque)
Returns a view of a
Deque as a Last-in-first-out (Lifo) Queue . |
<T> int |
binarySearch(List<? extends Comparable<? super T>> aList,
T aKey)
Searches the specified list for the specified object using the binary search algorithm.
|
<T> int |
binarySearch(List<? extends T> aList,
T aKey,
Comparator<? super T> aComparator)
Searches the specified list for the specified object using the binary search algorithm.
|
<E> Collection<E> |
checkedCollection(Collection<E> aCollection,
Class<E> aType)
Returns a dynamically typesafe view of the specified collection.
|
<E> List<E> |
checkedList(List<E> aList,
Class<E> aType)
Returns a dynamically typesafe view of the specified list.
|
<K,V> Map<K,V> |
checkedMap(Map<K,V> aMap,
Class<K> aKeyType,
Class<V> aValueType)
Returns a dynamically typesafe view of the specified map.
|
<K,V> NavigableMap<K,V> |
checkedNavigableMap(NavigableMap<K,V> m,
Class<K> keyType,
Class<V> valueType)
Returns a dynamically typesafe view of the specified navigable map.
|
<E> NavigableSet<E> |
checkedNavigableSet(NavigableSet<E> s,
Class<E> type)
Returns a dynamically typesafe view of the specified navigable set.
|
<E> Queue<E> |
checkedQueue(Queue<E> queue,
Class<E> type)
Returns a dynamically typesafe view of the specified queue.
|
<E> Set<E> |
checkedSet(Set<E> aSet,
Class<E> aType)
Returns a dynamically typesafe view of the specified set.
|
<K,V> SortedMap<K,V> |
checkedSortedMap(SortedMap<K,V> aMap,
Class<K> aKeyType,
Class<V> aValueType)
Returns a dynamically typesafe view of the specified sorted map.
|
<E> SortedSet<E> |
checkedSortedSet(SortedSet<E> aSet,
Class<E> aType)
Returns a dynamically typesafe view of the specified sorted set.
|
<T> void |
copy(List<? super T> aDestination,
List<? extends T> aSource)
Copies all of the elements from one list into another.
|
boolean |
disjoint(Collection<?> aCollection,
Collection<?> anAnotherCollection)
Returns true if the two specified collections have no elements in common.
|
<T> Enumeration<T> |
emptyEnumeration()
Returns an enumeration that has no elements.
|
<T> Iterator<T> |
emptyIterator()
Returns an iterator that has no elements.
|
<T> List<T> |
emptyList()
Returns the empty list (immutable).
|
<T> ListIterator<T> |
emptyListIterator()
Returns a list iterator that has no elements.
|
<K,V> Map<K,V> |
emptyMap()
Returns the empty map (immutable).
|
<K,V> NavigableMap<K,V> |
emptyNavigableMap()
Returns an empty navigable map (immutable).
|
<E> NavigableSet<E> |
emptyNavigableSet()
Returns an empty navigable set (immutable).
|
<T> Set<T> |
emptySet()
Returns the empty set (immutable).
|
<K,V> SortedMap<K,V> |
emptySortedMap()
Returns an empty sorted map (immutable).
|
<E> SortedSet<E> |
emptySortedSet()
Returns an empty sorted set (immutable).
|
<T> Enumeration<T> |
enumeration(Collection<T> aCollection)
Returns an enumeration over the specified collection.
|
<T> void |
fill(List<? super T> aList,
T aValue)
Replaces all of the elements of the specified list with the specified element.
|
int |
frequency(Collection<?> aCollection,
Object aValue)
Returns the number of elements in the specified collection equal to the specified object.
|
int |
indexOfSubList(List<?> aSource,
List<?> aTarget)
Returns the starting position of the first occurrence of the specified
target list within the specified source list, or -1 if there is no such occurrence.
|
int |
lastIndexOfSubList(List<?> aSource,
List<?> aTarget)
Returns the starting position of the last occurrence of the specified
target list within the specified source list, or -1 if there is no such occurrence.
|
<T> ArrayList<T> |
list(Enumeration<T> anEnumeration)
Returns an array list containing the elements returned by the specified enumeration in the order they are returned by the enumeration.
|
<T extends Object & Comparable<? super T>> |
max(Collection<? extends T> aCollection)
Returns the maximum element of the given collection, according to the
natural ordering of its elements.
|
<T> T |
max(Collection<? extends T> aCollection,
Comparator<? super T> aComparator)
Returns the maximum element of the given collection, according to the
order induced by the specified comparator.
|
<T extends Object & Comparable<? super T>> |
min(Collection<? extends T> aCollection)
Returns the minimum element of the given collection, according to the natural ordering of its elements.
|
<T> T |
min(Collection<? extends T> aCollection,
Comparator<? super T> aComparator)
Returns the minimum element of the given collection, according to the order induced by the specified comparator.
|
<T> List<T> |
nCopies(int aCount,
T aValue)
Returns an immutable list consisting of n copies of the specified object.
|
<E> Set<E> |
newSetFromMap(Map<E,Boolean> aMap)
Returns a set backed by the specified map.
|
<T> boolean |
replaceAll(List<T> aList,
T anOldValue,
T aNewValue)
Replaces all occurrences of one specified value in a list with another.
|
void |
reverse(List<?> aList)
Reverses the order of the elements in the specified list.
|
<T> Comparator<T> |
reverseOrder()
Returns a comparator that imposes the reverse of the natural ordering on a collection of objects that implement
the Comparable interface.
|
<T> Comparator<T> |
reverseOrder(Comparator<T> aComparator)
Returns a comparator that imposes the reverse ordering of the specified comparator.
|
void |
rotate(List<?> aList,
int aDistance)
Rotates the elements in the specified list by the specified distance.
|
void |
shuffle(List<?> aList)
Randomly permutes the specified list using a default source of randomness.
|
void |
shuffle(List<?> aList,
Random aRandom)
Randomly permute the specified list using the specified source of randomness.
|
<T> Set<T> |
singleton(T aValue)
Returns an immutable set containing only the specified object.
|
<T> List<T> |
singletonList(T aValue)
Returns an immutable list containing only the specified object.
|
<K,V> Map<K,V> |
singletonMap(K key,
V aValue)
Returns an immutable map, mapping only the specified key to the specified value.
|
<T extends Comparable<? super T>> |
sort(List<T> aList)
Sorts the specified list into ascending order, according to the natural ordering of its elements.
|
<T> void |
sort(List<T> aList,
Comparator<? super T> aComparator)
Sorts the specified list according to the order induced by the specified comparator.
|
void |
swap(List<?> aList,
int anIndex,
int anAnotherIndex)
Swaps the elements at the specified positions in the specified list.
|
<T> Collection<T> |
synchronizedCollection(Collection<T> aCollection)
Returns a synchronized (thread-safe) collection backed by the specified collection.
|
<T> List<T> |
synchronizedList(List<T> aList)
Returns a synchronized (thread-safe) list backed by the specified list.
|
<K,V> Map<K,V> |
synchronizedMap(Map<K,V> aMap)
Returns a synchronized (thread-safe) map backed by the specified map.
|
<K,V> NavigableMap<K,V> |
synchronizedNavigableMap(NavigableMap<K,V> m)
Returns a synchronized (thread-safe) navigable map backed by the
specified navigable map.
|
<T> NavigableSet<T> |
synchronizedNavigableSet(NavigableSet<T> s)
Returns a synchronized (thread-safe) navigable set backed by the
specified navigable set.
|
<T> Set<T> |
synchronizedSet(Set<T> aSet)
Returns a synchronized (thread-safe) set backed by the specified set.
|
<K,V> SortedMap<K,V> |
synchronizedSortedMap(SortedMap<K,V> aMap)
Returns a synchronized (thread-safe) sorted map backed by the specified sorted map.
|
<T> SortedSet<T> |
synchronizedSortedSet(SortedSet<T> aSet)
Returns a synchronized (thread-safe) sorted set backed by the specified sorted set.
|
<T> Collection<T> |
unmodifiableCollection(Collection<? extends T> aCollection)
Returns an unmodifiable view of the specified collection.
|
<T> List<T> |
unmodifiableList(List<? extends T> aList)
Returns an unmodifiable view of the specified list.
|
<K,V> Map<K,V> |
unmodifiableMap(Map<? extends K,? extends V> aMap)
Returns an unmodifiable view of the specified map.
|
<K,V> NavigableMap<K,V> |
unmodifiableNavigableMap(NavigableMap<K,? extends V> m)
Returns an unmodifiable view of the specified navigable map.
|
<T> NavigableSet<T> |
unmodifiableNavigableSet(NavigableSet<T> s)
Returns an unmodifiable view of the specified navigable set.
|
<T> Set<T> |
unmodifiableSet(Set<? extends T> aSet)
Returns an unmodifiable view of the specified set.
|
<K,V> SortedMap<K,V> |
unmodifiableSortedMap(SortedMap<K,? extends V> aMap)
Returns an unmodifiable view of the specified sorted map.
|
<T> SortedSet<T> |
unmodifiableSortedSet(SortedSet<T> aSet)
Returns an unmodifiable view of the specified sorted set.
|
static final Set EMPTY_SET
static final List EMPTY_LIST
static final Map EMPTY_MAP
<T extends Comparable<? super T>> void sort(List<T> aList)
T
- the class of the objects in the listaList
- the list to be sorted.ClassCastException
- if the list contains elements that are not mutually comparable (for example, strings and integers).UnsupportedOperationException
- if the specified list's list-iterator does not support the set operation.<T> void sort(List<T> aList, Comparator<? super T> aComparator)
T
- the class of the objects in the listaList
- the list to be sorted.aComparator
- the comparator to determine the order of the list. A null value indicates that the elements'
natural ordering should be used.ClassCastException
- if the list contains elements that are not mutually comparable using the specified comparator.UnsupportedOperationException
- if the specified list's list-iterator does not support the set operation.<T> int binarySearch(List<? extends Comparable<? super T>> aList, T aKey)
T
- the class of the objects in the listaList
- the list to be searched.aKey
- the key to be searched for.ClassCastException
- if the list contains elements that are not mutually comparable (for example, strings and integers), or the
search key is not mutually comparable with the elements of the list.<T> int binarySearch(List<? extends T> aList, T aKey, Comparator<? super T> aComparator)
T
- the class of the objects in the listaList
- the list to be searched.aKey
- the key to be searched for.aComparator
- the comparator by which the list is ordered. A null value indicates that the elements' Comparable natural
ordering should be used.ClassCastException
- if the list contains elements that are not mutually comparable using the specified comparator,
or the search key is not mutually comparable with the elements of the list using this comparator.void reverse(List<?> aList)
aList
- the list whose elements are to be reversed.UnsupportedOperationException
- if the specified list or its list-iterator does not support the set operation.void shuffle(List<?> aList)
aList
- the list to be shuffled.UnsupportedOperationException
- if the specified list or its list-iterator does not support the set operation.void shuffle(List<?> aList, Random aRandom)
aList
- the list to be shuffled.aRandom
- the source of randomness to use to shuffle the list.UnsupportedOperationException
- if the specified list or its list-iterator does not support the set operation.void swap(List<?> aList, int anIndex, int anAnotherIndex)
aList
- The list in which to swap elements.anIndex
- the index of one element to be swapped.anAnotherIndex
- the index of the other element to be swapped.IndexOutOfBoundsException
- if either anIndex or j is out of range (anIndex < 0 || anIndex >= aList.size()
|| anAnotherIndex < 0 || anAnotherIndex >= aList.size()).<T> void fill(List<? super T> aList, T aValue)
T
- the class of the objects in the listaList
- the list to be filled with the specified element.aValue
- The element with which to fill the specified list.UnsupportedOperationException
- if the specified list or its list-iterator does not support the set operation.<T> void copy(List<? super T> aDestination, List<? extends T> aSource)
T
- the class of the objects in the listaDestination
- The destination list.aSource
- The source list.IndexOutOfBoundsException
- if the destination list is too small to contain the entire source List.UnsupportedOperationException
- if the destination list's list-iterator does not support the set operation.<T extends Object & Comparable<? super T>> T min(Collection<? extends T> aCollection)
T
- the class of the objects in the collectionaCollection
- the collection whose minimum element is to be determined.ClassCastException
- if the collection contains elements that are not mutually comparable (for example, strings and integers).NoSuchElementException
- if the collection is empty.<T> T min(Collection<? extends T> aCollection, Comparator<? super T> aComparator)
T
- the class of the objects in the collectionaCollection
- the collection whose minimum element is to be determined.aComparator
- the comparator with which to determine the minimum element. A null value indicates that the elements'
natural ordering should be used.ClassCastException
- if the collection contains elements that are not mutually comparable using the specified comparator.NoSuchElementException
- if the collection is empty.<T extends Object & Comparable<? super T>> T max(Collection<? extends T> aCollection)
T
- the class of the objects in the collectionaCollection
- the collection whose maximum element is to be determined.ClassCastException
- if the collection contains elements that are not mutually comparable (for example, strings and integers).NoSuchElementException
- if the collection is empty.<T> T max(Collection<? extends T> aCollection, Comparator<? super T> aComparator)
T
- the class of the objects in the collectionaCollection
- the collection whose maximum element is to be determined.aComparator
- the comparator with which to determine the maximum element. A null value indicates that the elements'
natural ordering should be used.ClassCastException
- if the collection contains elements that are not mutually comparable using the specified comparator.NoSuchElementException
- if the collection is empty.void rotate(List<?> aList, int aDistance)
aList
- the list to be rotated.aDistance
- the distance to rotate the list. There are no constraints on this value; it may be zero, negative, or greater than
aList.size().UnsupportedOperationException
- if the specified list or its list-iterator does not support the set operation.<T> boolean replaceAll(List<T> aList, T anOldValue, T aNewValue)
T
- the class of the objects in the listaList
- the list in which replacement is to occur.anOldValue
- the old value to be replaced.aNewValue
- the new value with which anOldValue is to be replaced.UnsupportedOperationException
- if the specified list or its list-iterator does not support the set operation.int indexOfSubList(List<?> aSource, List<?> aTarget)
aSource
- the list in which to search for the first occurrence of target.aTarget
- the list to search for as a subList of aSource.int lastIndexOfSubList(List<?> aSource, List<?> aTarget)
aSource
- the list in which to search for the last occurrence of target.aTarget
- the list to search for as a subList of aSource.<T> Collection<T> unmodifiableCollection(Collection<? extends T> aCollection)
T
- the class of the objects in the collectionaCollection
- the collection for which an unmodifiable view is to be returned.<T> Set<T> unmodifiableSet(Set<? extends T> aSet)
T
- the class of the objects in the setaSet
- the set for which an unmodifiable view is to be returned.<T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> aSet)
T
- the class of the objects in the setaSet
- the sorted set for which an unmodifiable view is to be returned.<T> List<T> unmodifiableList(List<? extends T> aList)
T
- the class of the objects in the listaList
- the list for which an unmodifiable view is to be returned.<K,V> Map<K,V> unmodifiableMap(Map<? extends K,? extends V> aMap)
K
- the class of the map keysV
- the class of the map valuesaMap
- the map for which an unmodifiable view is to be returned.<K,V> SortedMap<K,V> unmodifiableSortedMap(SortedMap<K,? extends V> aMap)
K
- the class of the map keysV
- the class of the map valuesaMap
- the sorted map for which an unmodifiable view is to be returned.<T> Collection<T> synchronizedCollection(Collection<T> aCollection)
T
- the class of the objects in the collectionaCollection
- the collection to be "wrapped" in a synchronized collection.<T> Set<T> synchronizedSet(Set<T> aSet)
T
- the class of the objects in the setaSet
- the set to be "wrapped" in a synchronized set.<T> SortedSet<T> synchronizedSortedSet(SortedSet<T> aSet)
T
- the class of the objects in the setaSet
- the sorted set to be "wrapped" in a synchronized sorted set.<T> List<T> synchronizedList(List<T> aList)
T
- the class of the objects in the listaList
- the list to be "wrapped" in a synchronized list.<K,V> Map<K,V> synchronizedMap(Map<K,V> aMap)
K
- the class of the map keysV
- the class of the map valuesaMap
- the map to be "wrapped" in a synchronized map.<K,V> SortedMap<K,V> synchronizedSortedMap(SortedMap<K,V> aMap)
K
- the class of the map keysV
- the class of the map valuesaMap
- the sorted map to be "wrapped" in a synchronized sorted map.<E> Collection<E> checkedCollection(Collection<E> aCollection, Class<E> aType)
E
- the class of the objects in the collectionaCollection
- the collection for which a dynamically typesafe view is to be returnedaType
- the type of element that aCollection is permitted to hold<E> Set<E> checkedSet(Set<E> aSet, Class<E> aType)
E
- the class of the objects in the setaSet
- the set for which a dynamically typesafe view is to be returnedaType
- the type of element that aSet is permitted to hold<E> SortedSet<E> checkedSortedSet(SortedSet<E> aSet, Class<E> aType)
E
- the class of the objects in the setaSet
- the sorted set for which a dynamically typesafe view is to be returnedaType
- the type of element that aSet is permitted to hold<E> List<E> checkedList(List<E> aList, Class<E> aType)
E
- the class of the objects in the listaList
- the list for which a dynamically typesafe view is to be returnedaType
- the type of element that aList is permitted to hold<K,V> Map<K,V> checkedMap(Map<K,V> aMap, Class<K> aKeyType, Class<V> aValueType)
K
- the class of the map keysV
- the class of the map valuesaMap
- the map for which a dynamically typesafe view is to be returnedaKeyType
- the type of key that aMap is permitted to holdaValueType
- the type of value that aMap is permitted to hold<K,V> SortedMap<K,V> checkedSortedMap(SortedMap<K,V> aMap, Class<K> aKeyType, Class<V> aValueType)
K
- the class of the map keysV
- the class of the map valuesaMap
- the map for which a dynamically typesafe view is to be returnedaKeyType
- the type of key that aMap is permitted to holdaValueType
- the type of value that aMap is permitted to hold<T> Set<T> emptySet()
T
- the class of the objects in the set<T> List<T> emptyList()
T
- the class of the objects in the list<K,V> Map<K,V> emptyMap()
K
- the class of the map keysV
- the class of the map values<T> Set<T> singleton(T aValue)
T
- the class of the objects in the setaValue
- the sole object to be stored in the returned set.<T> List<T> singletonList(T aValue)
T
- the class of the objects in the listaValue
- the sole object to be stored in the returned list.<K,V> Map<K,V> singletonMap(K key, V aValue)
K
- the class of the map keysV
- the class of the map valueskey
- the sole key to be stored in the returned map.aValue
- the value to which the returned map maps key.<T> List<T> nCopies(int aCount, T aValue)
T
- the class of the objects in the listaCount
- the number of elements in the returned list.aValue
- the element to appear repeatedly in the returned list.IllegalArgumentException
- if aCount < 0.<T> Comparator<T> reverseOrder()
T
- the class of the objects compared by the comparator<T> Comparator<T> reverseOrder(Comparator<T> aComparator)
T
- the class of the objects compared by the comparatoraComparator
- the Comparator<T> Enumeration<T> enumeration(Collection<T> aCollection)
T
- the class of the objects in the collectionaCollection
- the collection for which an enumeration is to be returned.<T> ArrayList<T> list(Enumeration<T> anEnumeration)
T
- the class of the objects in the enumerationanEnumeration
- enumeration providing elements for the returned array listint frequency(Collection<?> aCollection, Object aValue)
aCollection
- the collection in which to determine the frequency of aValueaValue
- the object whose frequency is to be determinedaCollection
equal to aValue
NullPointerException
- if aCollection is nullboolean disjoint(Collection<?> aCollection, Collection<?> anAnotherCollection)
aCollection
- a collectionanAnotherCollection
- a collectiontrue
if the two specified collections have no elements in common.NullPointerException
- if either collection is null<T> boolean addAll(Collection<? super T> aCollection, T... aValues)
T
- the class of the elements to add and of the collectionaCollection
- the collection into which elements are to be insertedaValues
- the elements to insert into aCollectionUnsupportedOperationException
- if aCollection does not support the add operationNullPointerException
- if aValues contains one or more null values and aCollection does not permit null
elements, or if aCollection or aValues are nullIllegalArgumentException
- if some property of a value in aValues prevents it from being added to aCollection<E> Set<E> newSetFromMap(Map<E,Boolean> aMap)
E
- the class of the map keys and of the objects in the returned setaMap
- the backing mapIllegalArgumentException
- if aMap is not empty<T> Queue<T> asLifoQueue(Deque<T> aDeque)
Deque
as a Last-in-first-out (Lifo) Queue
.T
- the class of the objects in the dequeaDeque
- the deque<T> Iterator<T> emptyIterator()
T
- type of elements, if there were any, in the iterator<T> ListIterator<T> emptyListIterator()
T
- type of elements, if there were any, in the iterator<T> Enumeration<T> emptyEnumeration()
T
- the class of the objects in the enumeration<T> NavigableSet<T> unmodifiableNavigableSet(NavigableSet<T> s)
T
- the class of the objects in the sets
- the navigable set for which an unmodifiable view is to be returned<K,V> NavigableMap<K,V> unmodifiableNavigableMap(NavigableMap<K,? extends V> m)
K
- the class of the map keysV
- the class of the map valuesm
- the navigable map for which an unmodifiable view is to be returned<T> NavigableSet<T> synchronizedNavigableSet(NavigableSet<T> s)
T
- the class of the objects in the sets
- the navigable set to be "wrapped" in a synchronized navigableset<K,V> NavigableMap<K,V> synchronizedNavigableMap(NavigableMap<K,V> m)
K
- the class of the map keysV
- the class of the map valuesm
- the navigable map to be "wrapped" in a synchronized navigable map<E> Queue<E> checkedQueue(Queue<E> queue, Class<E> type)
E
- the class of the objects in the queuequeue
- the queue for which a dynamically typesafe view is to be returnedtype
- the type of element that queue
is permitted to hold<E> NavigableSet<E> checkedNavigableSet(NavigableSet<E> s, Class<E> type)
E
- the class of the objects in the sets
- the navigable set for which a dynamically typesafe view is to be returnedtype
- the type of element that s
is permitted to hold<K,V> NavigableMap<K,V> checkedNavigableMap(NavigableMap<K,V> m, Class<K> keyType, Class<V> valueType)
K
- type of map keysV
- type of map valuesm
- the map for which a dynamically typesafe view is to be returnedkeyType
- the type of key that m
is permitted to holdvalueType
- the type of value that m
is permitted to hold<E> SortedSet<E> emptySortedSet()
E
- type of elements, if there were any, in the set<E> NavigableSet<E> emptyNavigableSet()
E
- type of elements, if there were any, in the set<K,V> SortedMap<K,V> emptySortedMap()
K
- the class of the map keysV
- the class of the map values<K,V> NavigableMap<K,V> emptyNavigableMap()
K
- the class of the map keysV
- the class of the map valuesSitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.