|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.velocity.tools.CollectionsTool
public class CollectionsTool
Velocity Tool allowing to create various type of collections.
| Constructor Summary | |
|---|---|
CollectionsTool()
|
|
| Method Summary | ||
|---|---|---|
|
disjunction(Collection<E> a,
Collection<E> b)
Returns a Collection containing the exclusive disjunction (symmetric difference) of the given
Collections. |
|
|
getArrayList()
Create and return a new ArrayList, an unbounded list with constant access time and good performance for
most additions at the end of the list, but which performs poorly when deleting items, when inserting a new item
in the list and when appending a new item requires resizing the allocated space. |
|
|
getBlockingQueue()
Create and return a new BlockingQueue, an unbounded queue that additionally supports operations that wait
for the queue to become non-empty when retrieving an element. |
|
|
getLinkedList()
Create and return a new LinkedList, optimized for insertion and deletion of items, and for sequential
iteration over the items, but not for quick access to random positions in the list. |
|
|
getMap()
Create and return a new Map, providing good speed for insertion, retrieval and deletion of items, but
with no guarantees on the order of the map. |
|
|
getOrderedMap()
Create and return a new Map, which ensures that iterating the map will always return the entries in the
same order as they were added. |
|
|
getOrderedSet()
Create and return a new Set, which ensures that iterating the set will always return the entries in the
same order as they were added. |
|
|
getPriorityQueue()
Create and return a new Queue, which instead of the FIFO ordering uses the natural order of the items
added to the queue, so that the retrieved item is always the lowest one. |
|
|
getQueue()
Create and return a new Queue, an unbounded list where items are ordered in a FIFO (first-in-first-out)
manner. |
|
|
getSet()
Create and return a new Set, providing good speed for insertion, retrieval and deletion of items, but
with no guarantees on the order of the set. |
|
|
getSortedMap()
Create and return a new SortedMap, which ensures that iterating the map will always return the entries in
the natural order of the keys. |
|
|
getSortedSet()
Create and return a new SortedSet, which ensures that iterating the set will always return the entries in
the natural order of the items. |
|
|
intersection(Collection<E> a,
Collection<E> b)
Returns a Collection containing the intersection of the given Collections. |
|
|
reverse(List<E> input)
Reverse the order of the elements within a list, so that the last element is moved to the beginning of the list, the next-to-last element to the second position, and so on. |
|
|
sort(List<E> input)
Sort the elements within a list according to their natural order. |
|
|
union(Collection<E> a,
Collection<E> b)
Returns a Collection containing the union of the given Collections. |
|
|
unmodifiable(Collection<E> input)
Returns an unmodifiable view of the specified collection. |
|
|
unmodifiable(List<E> input)
Returns an unmodifiable view of the specified list. |
|
|
unmodifiable(Map<K,V> input)
Returns an unmodifiable view of the specified map. |
|
|
unmodifiable(Set<E> input)
Returns an unmodifiable view of the specified set. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CollectionsTool()
| Method Detail |
|---|
public <E> List<E> getArrayList()
ArrayList, an unbounded list with constant access time and good performance for
most additions at the end of the list, but which performs poorly when deleting items, when inserting a new item
in the list and when appending a new item requires resizing the allocated space.
E - the type of the elements in the list
ArrayListpublic <E> List<E> getLinkedList()
LinkedList, optimized for insertion and deletion of items, and for sequential
iteration over the items, but not for quick access to random positions in the list.
E - the type of the elements in the list
LinkedListpublic <K,V> Map<K,V> getMap()
Map, providing good speed for insertion, retrieval and deletion of items, but
with no guarantees on the order of the map.
K - the type of keys maintained by this mapV - the type of mapped values
HashMappublic <K extends Comparable<K>,V> SortedMap<K,V> getSortedMap()
SortedMap, which ensures that iterating the map will always return the entries in
the natural order of the keys.
K - the type of keys maintained by this mapV - the type of mapped values
TreeMappublic <K,V> Map<K,V> getOrderedMap()
Map, which ensures that iterating the map will always return the entries in the
same order as they were added.
K - the type of keys maintained by this mapV - the type of mapped values
LinkedHashMappublic <E> Set<E> getSet()
Set, providing good speed for insertion, retrieval and deletion of items, but
with no guarantees on the order of the set.
E - the type of the elements in the set
HashSetpublic <E extends Comparable<E>> SortedSet<E> getSortedSet()
SortedSet, which ensures that iterating the set will always return the entries in
the natural order of the items.
E - the type of the elements in the set
TreeSetpublic <E> Set<E> getOrderedSet()
Set, which ensures that iterating the set will always return the entries in the
same order as they were added.
E - the type of the elements in the set
LinkedHashSetpublic <E> Queue<E> getQueue()
Queue, an unbounded list where items are ordered in a FIFO (first-in-first-out)
manner.
E - the type of the elements in the queue
LinkedListpublic <E> BlockingQueue<E> getBlockingQueue()
BlockingQueue, an unbounded queue that additionally supports operations that wait
for the queue to become non-empty when retrieving an element.
E - the type of the elements in the queue
BlockingQueuepublic <E extends Comparable<E>> Queue<E> getPriorityQueue()
Queue, which instead of the FIFO ordering uses the natural order of the items
added to the queue, so that the retrieved item is always the lowest one. All the items added to this queue must
be non-null and be comparable with the other items in the queue.
E - the type of the elements in the queue
PriorityQueuepublic <E> List<E> unmodifiable(List<E> input)
E - the type of the elements in the listinput - the list to wrap in an unmodifiable bridge
public <K,V> Map<K,V> unmodifiable(Map<K,V> input)
K - the type of keys maintained by this mapV - the type of mapped valuesinput - the map to wrap in an unmodifiable bridge
public <E> Set<E> unmodifiable(Set<E> input)
E - the type of the elements in the setinput - the set to wrap in an unmodifiable bridge
public <E> Collection<E> unmodifiable(Collection<E> input)
E - the type of the elements in the collectioninput - the collection to wrap in an unmodifiable bridge
public <E> Collection<E> union(Collection<E> a,
Collection<E> b)
Collection containing the union of the given Collections.
E - the type of the elements in the collectiona - the first collection, must be non-nullb - the second collection, must be non-null
public <E> Collection<E> intersection(Collection<E> a,
Collection<E> b)
Collection containing the intersection of the given Collections.
E - the type of the elements in the collectiona - the first collection, must be non-nullb - the second collection, must be non-null
public <E> Collection<E> disjunction(Collection<E> a,
Collection<E> b)
Collection containing the exclusive disjunction (symmetric difference) of the given
Collections.
E - the type of the elements in the collectiona - the first collection, must be non-nullb - the second collection, must be non-null
public <E> boolean reverse(List<E> input)
E - the type of the elements in the listinput - the list to reverse
true if the list was successfully reversed, false otherwisepublic <E extends Comparable<E>> boolean sort(List<E> input)
E - the type of the elements in the listinput - the list to sort
true if the list was successfully sorted, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||