|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.ioc.internal.util.CollectionFactory
public final class CollectionFactory
Static factory methods to ease the creation of new collection types (when using generics). Most of these method leverage the compiler's ability to match generic types by return value. Typical usage (with a static import):
Map<Foo, Bar> map = newMap();This is a replacement for:
Map<Foo, Bar> map = new HashMap<Foo, Bar>();
Constructor Summary | |
---|---|
CollectionFactory()
|
Method Summary | ||
---|---|---|
static
|
newCaseInsensitiveMap()
|
|
static
|
newCaseInsensitiveMap(Map<String,? extends V> map)
|
|
static
|
newConcurrentMap()
Constructs a new concurrent map, which is safe to access via multiple threads. |
|
static
|
newLinkedList()
Useful for queues. |
|
static
|
newList()
Contructs and returns a new generic ArrayList instance. |
|
static
|
newList(Collection<V> list)
Constructs and returns a new ArrayList as a copy of the provided collection. |
|
static
|
newList(V... elements)
Creates a new, fully modifiable list from an initial set of elements. |
|
static
|
newMap()
Constructs and returns a generic HashMap instance. |
|
static
|
newMap(Map<? extends K,? extends V> map)
Constructs a new HashMap instance by copying an existing Map instance. |
|
static
|
newSet()
Constructs and returns a generic HashSet instance. |
|
static
|
newSet(Collection<V> values)
Contructs a new HashSet and initializes it using the provided collection. |
|
static
|
newSet(V... values)
|
|
static
|
newStack()
|
|
static
|
newStack(int initialSize)
|
|
static
|
newThreadSafeList()
Constructs and returns a new CopyOnWriteArrayList . |
|
static
|
newWeakHashMap()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionFactory()
Method Detail |
---|
public static <K,V> Map<K,V> newMap()
HashMap
instance.
public static <T> Set<T> newSet()
HashSet
instance.
public static <T,V extends T> Set<T> newSet(Collection<V> values)
HashSet
and initializes it using the provided collection.
public static <T,V extends T> Set<T> newSet(V... values)
public static <K,V> Map<K,V> newMap(Map<? extends K,? extends V> map)
HashMap
instance by copying an existing Map instance.
public static <K,V> ConcurrentMap<K,V> newConcurrentMap()
public static <K,V> Map<K,V> newWeakHashMap()
public static <T> List<T> newList()
ArrayList
instance.
public static <T,V extends T> List<T> newList(V... elements)
public static <T> LinkedList<T> newLinkedList()
public static <T,V extends T> List<T> newList(Collection<V> list)
ArrayList
as a copy of the provided collection.
public static <T> List<T> newThreadSafeList()
CopyOnWriteArrayList
.
public static <T> Stack<T> newStack()
public static <T> Stack<T> newStack(int initialSize)
public static <V> Map<String,V> newCaseInsensitiveMap()
public static <V> Map<String,V> newCaseInsensitiveMap(Map<String,? extends V> map)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |