org.openxava.util
Class XCollections

java.lang.Object
  extended by org.openxava.util.XCollections

public class XCollections
extends java.lang.Object

Utilities to work with collections, enumerations and iterators.

Author:
Javier Paniza

Constructor Summary
XCollections()
           
 
Method Summary
static void add(java.util.Collection collection, java.util.Enumeration toAdd)
          Adds elements from the enumeration to the collection.
static java.lang.Object last(java.util.Collection collection)
          Returns the last element of sent collection.
static void println(java.util.Collection c)
          Print in standard output the collection elements.
static void println(java.util.Iterator it)
          Print in standard output the elements by it iterate.
static java.util.Collection toCollection(java.util.Enumeration e)
          Returns a collection from a enumeration.
static java.lang.String[] toStringArray(java.util.Collection c)
          Returns a String [] from a collection of Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XCollections

public XCollections()
Method Detail

last

public static java.lang.Object last(java.util.Collection collection)
Returns the last element of sent collection.

Parameters:
collection - Cannot be null

add

public static void add(java.util.Collection collection,
                       java.util.Enumeration toAdd)
Adds elements from the enumeration to the collection.

Parameters:
collection - Not null
toAdd - If null no elements are added.

println

public static void println(java.util.Collection c)
Print in standard output the collection elements.

Util to debug.

Parameters:
c - Can be null.

println

public static void println(java.util.Iterator it)
Print in standard output the elements by it iterate.

Util to debug.

Parameters:
c - Can be null.

toCollection

public static java.util.Collection toCollection(java.util.Enumeration e)
Returns a collection from a enumeration.

Parameters:
e - If null then returns a empty collection
Returns:
Not null.

toStringArray

public static java.lang.String[] toStringArray(java.util.Collection c)
Returns a String [] from a collection of Strings.

Parameters:
c - Elements must be of type String. If null then returns a empty array.
Returns:
Not null.