net.sf.oness.common.model.util
Class CollectionUtils

java.lang.Object
  extended bynet.sf.oness.common.model.util.CollectionUtils

public class CollectionUtils
extends java.lang.Object

Some utility methods to use Collections

Version:
$Revision: 1.4 $
Author:
Carlos Sanchez

Constructor Summary
CollectionUtils()
           
 
Method Summary
static java.util.List add(java.util.List list, java.lang.Object object)
          Add an object to a List and return the result.
static java.util.Set add(java.util.Set set, java.lang.Object object)
          Add an object to a Set and return the result.
static java.util.Collection clone(java.util.Collection collection)
          Clone a Collection copying all its elements to a new one.
static java.util.Map clone(java.util.Map map)
          Clone a Map copying all its elements to a new one.
static boolean isCollection(java.lang.Class theClass)
           
static boolean isMap(java.lang.Class theClass)
           
static java.util.List newList(java.lang.Object object)
          Return a List (actually an ArrayList) with only that object.
static java.util.Set newSet(java.lang.Object object)
          Return a Set (actually a HashSet) with only that object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtils

public CollectionUtils()
Method Detail

add

public static java.util.Set add(java.util.Set set,
                                java.lang.Object object)
Add an object to a Set and return the result.

Parameters:
set -
object -
Returns:

add

public static java.util.List add(java.util.List list,
                                 java.lang.Object object)
Add an object to a List and return the result.

Parameters:
object -
Returns:

newSet

public static java.util.Set newSet(java.lang.Object object)
Return a Set (actually a HashSet) with only that object.

Returns:

newList

public static java.util.List newList(java.lang.Object object)
Return a List (actually an ArrayList) with only that object.

Returns:

isCollection

public static boolean isCollection(java.lang.Class theClass)

isMap

public static boolean isMap(java.lang.Class theClass)

clone

public static java.util.Collection clone(java.util.Collection collection)
Clone a Collection copying all its elements to a new one. If map is null return null.

Parameters:
collection -
Returns:

clone

public static java.util.Map clone(java.util.Map map)
Clone a Map copying all its elements to a new one. If map is null return null.

Parameters:
map -
Returns:


Copyright © 2003-2005 ONess Project. All Rights Reserved.