|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.xtext.xbase.lib.CollectionLiterals
public class CollectionLiterals
This is an extension library for collections
.
Constructor Summary | |
---|---|
CollectionLiterals()
|
Method Summary | ||
---|---|---|
static
|
emptyList()
Returns the empty, immutable list. |
|
static
|
emptyMap()
Returns the empty, immutable map. |
|
static
|
emptySet()
Returns the empty, immutable set. |
|
static
|
newArrayList(T... initial)
Creates a mutable ArrayList instance containing the given initial elements. |
|
static
|
newHashMap(Pair<K,V>... initial)
Creates a mutable HashMap instance containing the given initial entries. |
|
static
|
newHashSet(T... initial)
Creates a mutable HashSet instance containing the given initial elements. |
|
static
|
newImmutableList(T... elements)
Returns an immutable list containing the given elements, in order. |
|
static
|
newImmutableMap(Pair<K,V>... entries)
Returns an immutable map containing the given entries. |
|
static
|
newImmutableSet(T... elements)
Returns an immutable set containing the given elements. |
|
static
|
newLinkedHashMap(Pair<K,V>... initial)
Creates a mutable LinkedHashMap instance containing the given initial entries. |
|
static
|
newLinkedHashSet(T... initial)
Creates a mutable LinkedHashSet instance containing the given initial elements. |
|
static
|
newLinkedList(T... initial)
Creates a mutable LinkedList instance containing the given initial elements. |
|
static
|
newTreeMap(java.util.Comparator<? super K> comparator,
Pair<K,V>... initial)
Creates a mutable TreeMap instance containing the given initial entries. |
|
static
|
newTreeSet(java.util.Comparator<? super T> comparator,
T... initial)
Creates a mutable TreeSet instance containing the given initial elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionLiterals()
Method Detail |
---|
public static final <T> java.util.List<T> emptyList()
Collections.emptyList()
public static final <T> java.util.Set<T> emptySet()
Collections.emptySet()
public static final <K,V> java.util.Map<K,V> emptyMap()
Collections.emptyMap()
public static final <T> java.util.List<T> newImmutableList(T... elements)
elements
- the elements that should be contained in the list. May not be null
or contain any
null
values.
java.lang.NullPointerException
- if elements
or any of items in elements
is null
public static final <T> java.util.Set<T> newImmutableSet(T... elements)
Object.equals(java.lang.Object)
) after the first are ignored
elements
- the elements that should be contained in the set. May not be null
or contain any
null
values.
java.lang.NullPointerException
- if elements
or any of items in elements
is null
public static final <K,V> java.util.Map<K,V> newImmutableMap(Pair<K,V>... entries)
IllegalArgumentException
.
entries
- the entries that should be contained in the map. May not be null
or contain any
null
keys or value.
java.lang.NullPointerException
- if entries
or any key or value in entries
is null
java.lang.IllegalArgumentException
- if duplicate keys are contained in entries
.public static final <T> java.util.ArrayList<T> newArrayList(T... initial)
ArrayList
instance containing the given initial elements.
initial
- the initial elements that the list should contain, in order. May not be null
but may
contain null
values.
ArrayList
containing those elementspublic static final <T> java.util.LinkedList<T> newLinkedList(T... initial)
LinkedList
instance containing the given initial elements.
initial
- the initial elements that the list should contain, in order. May not be null
but may
contain null
values.
LinkedList
containing those elementspublic static final <T> java.util.HashSet<T> newHashSet(T... initial)
HashSet
instance containing the given initial elements.
initial
- the initial elements that the set should contain, in order. May not be null
but may
contain null
values.
HashSet
containing those elementspublic static final <T> java.util.LinkedHashSet<T> newLinkedHashSet(T... initial)
LinkedHashSet
instance containing the given initial elements.
initial
- the initial elements that the set should contain, in order. May not be null
but may
contain null
values.
LinkedHashSet
containing those elementspublic static final <T> java.util.TreeSet<T> newTreeSet(java.util.Comparator<? super T> comparator, T... initial)
TreeSet
instance containing the given initial elements.
initial
- the initial elements that the set should contain, in order. May not be null
but may
contain null
values.comparator
- the comparator that should be used. May be null
which indicates that the natural ordering
of the items should be used.
TreeSet
containing those elementspublic static final <K,V> java.util.HashMap<K,V> newHashMap(Pair<K,V>... initial)
HashMap
instance containing the given initial entries. Repeated occurrences of a keys
will cause an IllegalArgumentException
.
initial
- the entries that should be contained in the map. May not be null
but may contain
null
keys or values.
HashMap
containing those elements
java.lang.IllegalArgumentException
- if duplicate keys are contained the initial
entries.public static final <K,V> java.util.LinkedHashMap<K,V> newLinkedHashMap(Pair<K,V>... initial)
LinkedHashMap
instance containing the given initial entries. Repeated occurrences of a
keys will cause an IllegalArgumentException
.
initial
- the entries that should be contained in the map. May not be null
but may contain
null
keys or values.
LinkedHashMap
containing those elements
java.lang.IllegalArgumentException
- if duplicate keys are contained the initial
entries.public static final <K,V> java.util.TreeMap<K,V> newTreeMap(java.util.Comparator<? super K> comparator, Pair<K,V>... initial)
TreeMap
instance containing the given initial entries. Repeated occurrences of a keys
will cause an IllegalArgumentException
.
initial
- the entries that should be contained in the map. May not be null
but may contain
null
keys or values.comparator
- the comparator that should be used. May be null
which indicates that the natural ordering
of the keys should be used.
TreeMap
containing those elements
java.lang.IllegalArgumentException
- if duplicate keys are contained the initial
entries.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |