|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.CollectionFactory
public abstract class CollectionFactory
Factory for collections, being aware of JDK 1.4+ extended collections and Commons Collection 3.x's corresponding versions for older JDKs, as well as JDK 1.5+ concurrent collections and backport-concurrent versions of those. Mainly for internal use within the framework.
The goal of this class is to avoid runtime dependencies on JDK 1.4+ or Commons Collections 3.x, simply using the best collection implementation that is available. Prefers JDK 1.4+ collection implementations to Commons Collections 3.x versions, falling back to JDK 1.3 collections as worst case.
createLinkedSetIfPossible(int)
,
createLinkedMapIfPossible(int)
,
createLinkedCaseInsensitiveMapIfPossible(int)
,
createIdentityMapIfPossible(int)
Constructor Summary | |
---|---|
CollectionFactory()
|
Method Summary | |
---|---|
static Collection |
createApproximateCollection(Object collection,
int initialCapacity)
Create the most approximate collection for the given collection. |
static Map |
createApproximateMap(Object map,
int initialCapacity)
Create the most approximate map for the given map. |
static Map |
createConcurrentMapIfPossible(int initialCapacity)
Create a concurrent Map if possible: that is, if running on JDK >= 1.5 or if the backport-concurrent library is available. |
static Map |
createIdentityMapIfPossible(int initialCapacity)
Create an identity Map if possible: that is, if running on JDK >= 1.4 or if Commons Collections 3.x is available. |
static Map |
createLinkedCaseInsensitiveMapIfPossible(int initialCapacity)
Create a linked case-insensitive Map if possible: if Commons Collections 3.x is available, a CaseInsensitiveMap with ListOrderedMap decorator will be created. |
static Map |
createLinkedMapIfPossible(int initialCapacity)
Create a linked Map if possible: that is, if running on JDK >= 1.4 or if Commons Collections 3.x is available. |
static Set |
createLinkedSetIfPossible(int initialCapacity)
Create a linked Set if possible: that is, if running on JDK >= 1.4 or if Commons Collections 3.x is available. |
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 Set createLinkedSetIfPossible(int initialCapacity)
initialCapacity
- the initial capacity of the Set
LinkedHashSet
,
ListOrderedSet
public static Map createLinkedMapIfPossible(int initialCapacity)
initialCapacity
- the initial capacity of the Map
LinkedHashMap
,
LinkedMap
public static Map createLinkedCaseInsensitiveMapIfPossible(int initialCapacity)
LinkedHashMap
will be used.
initialCapacity
- the initial capacity of the Map
CaseInsensitiveMap
,
ListOrderedMap
public static Map createIdentityMapIfPossible(int initialCapacity)
initialCapacity
- the initial capacity of the Map
IdentityHashMap
,
IdentityMap
public static Map createConcurrentMapIfPossible(int initialCapacity)
initialCapacity
- the initial capacity of the Map
ConcurrentHashMap
,
ConcurrentHashMap
public static Collection createApproximateCollection(Object collection, int initialCapacity)
Creates an ArrayList, TreeSet or linked Set for a List, SortedSet or Set, respectively.
collection
- the original collection objectinitialCapacity
- the initial capacity
ArrayList
,
TreeSet
,
createLinkedSetIfPossible(int)
public static Map createApproximateMap(Object map, int initialCapacity)
Creates a TreeMap or linked Map for a SortedMap or Map, respectively.
map
- the original map objectinitialCapacity
- the initial capacity
TreeMap
,
createLinkedMapIfPossible(int)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |