org.springframework.core
Class CollectionFactory
java.lang.Object
org.springframework.core.CollectionFactory
- public class CollectionFactory
- extends java.lang.Object
Factory for collections, being aware of JDK 1.4's extended collections
and Commons Collection 3.1's corresponding versions for older JDKs.
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.
- Since:
- 1.1.1
- Author:
- Juergen Hoeller
Method Summary |
static java.util.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 java.util.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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollectionFactory
public CollectionFactory()
createLinkedMapIfPossible
public static java.util.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. Prefers a JDK 1.4
LinkedHashMap to a Commons Collections 3.x LinkedMap.
- Parameters:
initialCapacity
- the initial capacity of the map
- Returns:
- the new map instance
- See Also:
LinkedHashMap
,
LinkedMap
createIdentityMapIfPossible
public static java.util.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. Prefers a JDK 1.4
IdentityHashMap to a Commons Collections 3.x IdentityMap.
- Parameters:
initialCapacity
- the initial capacity of the map
- Returns:
- the new map instance
- See Also:
IdentityHashMap
,
IdentityMap
Copyright (C) 2003-2004 The Spring Framework Project.