java.lang.Object | |
↳ | org.springframework.util.CollectionUtils |
Miscellaneous collection utility methods. Mainly for internal use within the framework.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Convert the supplied array into a List.
| |||||||||||
Check whether the given Enumeration contains the given element.
| |||||||||||
Check whether the given Iterator contains the given element.
| |||||||||||
Return
true if any element in 'candidates ' is
contained in 'source '; otherwise returns false . | |||||||||||
Check whether the given Collection contains the given element instance.
| |||||||||||
Find the common element type of the given Collection, if any.
| |||||||||||
Return the first element in '
candidates ' that is contained in
'source '. | |||||||||||
Find a single value of the given type in the given Collection.
| |||||||||||
Find a single 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.
| |||||||||||
Determine whether the given Collection only contains a single unique object.
| |||||||||||
Return
true if the supplied Map is null
or empty. | |||||||||||
Return
true if the supplied Collection is null
or empty. | |||||||||||
Merge the given array into the given Collection.
| |||||||||||
Merge the given Properties instance into the given Map,
copying all properties (key-value pairs) over.
| |||||||||||
Marshal the elements from the given enumeration into an array of the given type.
| |||||||||||
Adapt an enumeration to an iterator.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Convert the supplied array into a List. A primitive array gets converted into a List of the appropriate wrapper type.
A null
source value will be converted to an
empty List.
source | the (potentially primitive) array |
---|
Check whether the given Enumeration contains the given element.
enumeration | the Enumeration to check |
---|---|
element | the element to look for |
true
if found, false
else
Check whether the given Iterator contains the given element.
iterator | the Iterator to check |
---|---|
element | the element to look for |
true
if found, false
else
Return true
if any element in 'candidates
' is
contained in 'source
'; otherwise returns false
.
source | the source Collection |
---|---|
candidates | the candidates to search for |
Check whether the given Collection contains the given element instance.
Enforces the given instance to be present, rather than returning
true
for an equal element as well.
collection | the Collection to check |
---|---|
element | the element to look for |
true
if found, false
else
Find the common element type of the given Collection, if any.
collection | the Collection to check |
---|
null
if no clear
common type has been found (or the collection was empty)
Return the first element in 'candidates
' that is contained in
'source
'. If no element in 'candidates
' is present in
'source
' returns null
. Iteration order is
Collection
implementation specific.
source | the source Collection |
---|---|
candidates | the candidates to search for |
null
if not found
Find a single value of the given type in the given Collection.
collection | the Collection to search |
---|---|
type | the type to look for |
null
if none or more than one such value found
Find a single 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.
collection | the collection to search |
---|---|
types | the types to look for, in prioritized order |
null
if none or more than one such value found
Determine whether the given Collection only contains a single unique object.
collection | the Collection to check |
---|
true
if the collection contains a single reference or
multiple references to the same instance, false
else
Return true
if the supplied Map is null
or empty. Otherwise, return false
.
map | the Map to check |
---|
Return true
if the supplied Collection is null
or empty. Otherwise, return false
.
collection | the Collection to check |
---|
Merge the given array into the given Collection.
array | the array to merge (may be null ) |
---|---|
collection | the target Collection to merge the array into |
Merge the given Properties instance into the given Map, copying all properties (key-value pairs) over.
Uses Properties.propertyNames()
to even catch
default properties linked into the original Properties instance.
props | the Properties instance to merge (may be null ) |
---|---|
map | the target Map to merge the properties into |
Marshal the elements from the given enumeration into an array of the given type. Enumeration elements must be assignable to the type of the given array. The array returned will be a different instance than the array given.
Adapt an enumeration to an iterator.
enumeration | the enumeration |
---|