|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.util.CollectionUtils
public abstract class CollectionUtils
Miscellaneous collection utility methods. Mainly for internal use within the framework.
Constructor Summary | |
---|---|
CollectionUtils()
|
Method Summary | |
---|---|
static Object |
findValueOfType(Collection coll,
Class type)
Find a value of the given type in the given collection. |
static Object |
findValueOfType(Collection coll,
Class[] types)
Find a value of one of the given types in the given collection: searching the collection for a value of the first type, then searching for a value of the second type, etc. |
static boolean |
hasUniqueObject(Collection coll)
Determine whether the given collection only contains a single unique object. |
static boolean |
isEmpty(Collection collection)
Return true if the supplied Collection is null or empty. |
static boolean |
isEmpty(Map map)
Return true if the supplied Map is null or empty. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionUtils()
Method Detail |
---|
public static boolean isEmpty(Collection collection)
true
if the supplied Collection
is null or empty.
Otherwise, return false
.
collection
- the Collection
to checkpublic static boolean isEmpty(Map map)
true
if the supplied Map
is null or empty.
Otherwise, return false
.
map
- the Map
to checkpublic static boolean hasUniqueObject(Collection coll)
coll
- the collection to check
true
if the collection contains a
single reference or multiple references to the same
instance, false
elsepublic static Object findValueOfType(Collection coll, Class type) throws IllegalArgumentException
coll
- the collection to searchtype
- the type to look for
null
if none
IllegalArgumentException
- if more than one value
of the given type foundpublic static Object findValueOfType(Collection coll, Class[] types) throws IllegalArgumentException
coll
- the collection to searchtypes
- the types to look for, in prioritized order
null
if none
IllegalArgumentException
- if more than one value
of the given type found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |