Spring Web Flow

org.springframework.webflow.core.collection
Class CollectionUtils

java.lang.Object
  extended by org.springframework.webflow.core.collection.CollectionUtils

public class CollectionUtils
extends java.lang.Object

A utility class for working with attribute and parameter collections used by Spring Web FLow.

Author:
Keith Donald, Erwin Vervaet

Field Summary
static AttributeMap<java.lang.Object> EMPTY_ATTRIBUTE_MAP
          The shared, singleton empty attribute map instance.
static java.util.Iterator EMPTY_ITERATOR
          The shared, singleton empty iterator instance.
 
Method Summary
static
<T> boolean
addAllNoDuplicates(java.util.List<T> target, T... objects)
          Add all given objects to given target list.
static
<E> java.util.Iterator<E>
emptyIterator()
           
static
<V> AttributeMap<V>
singleEntryMap(java.lang.String attributeName, V attributeValue)
          Factory method that returns a unmodifiable attribute map with a single entry.
static
<E> java.util.Iterator<E>
toIterator(java.util.Enumeration<E> enumeration)
          Factory method that adapts an enumeration to an iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ITERATOR

public static final java.util.Iterator EMPTY_ITERATOR
The shared, singleton empty iterator instance.


EMPTY_ATTRIBUTE_MAP

public static final AttributeMap<java.lang.Object> EMPTY_ATTRIBUTE_MAP
The shared, singleton empty attribute map instance.

Method Detail

emptyIterator

public static <E> java.util.Iterator<E> emptyIterator()

toIterator

public static <E> java.util.Iterator<E> toIterator(java.util.Enumeration<E> enumeration)
Factory method that adapts an enumeration to an iterator.

Parameters:
enumeration - the enumeration
Returns:
the iterator

singleEntryMap

public static <V> AttributeMap<V> singleEntryMap(java.lang.String attributeName,
                                                 V attributeValue)
Factory method that returns a unmodifiable attribute map with a single entry.

Parameters:
attributeName - the attribute name
attributeValue - the attribute value
Returns:
the unmodifiable map with a single element

addAllNoDuplicates

public static <T> boolean addAllNoDuplicates(java.util.List<T> target,
                                             T... objects)
Add all given objects to given target list. No duplicates will be added. The contains() method of the given target list will be used to determine whether or not an object is already in the list.

Parameters:
target - the collection to which to objects will be added
objects - the objects to add
Returns:
whether or not the target collection changed

Spring Web Flow