Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.acegisecurity.domain.util
Class CollectionUtils

    java.lang.Object
      org.acegisecurity.domain.util.CollectionUtils

    public class CollectionUtils

extends Object

Some utility methods to use `Collection`s.

Version:
  $Id: CollectionUtils.java,v 1.3 2005/11/17 00:55:50 benalex Exp $
Author:
  Carlos Sanchez

Constructor Summary
`CollectionUtils()`

Method Summary
`static
`<E> List<E>`
` | `add(List<E> list, E object)` Add an object to a `List` and return the result.
`static
`<E> Set<E>`
` | `add(Set<E> set, E object)` Add an object to a `Set` and return the result.
`static
`<E> Collection<E>`
` | `clone(Collection<E> collection)` Clone a Collection copying all its elements to a new one.
`static
`<K,V> Map<K,V>`
` | `clone(Map<K,V> map)` Clone a `Map` copying all its elements to a new one.
`static boolean` | `isCollection(Class theClass)`
`static boolean` | `isMap(Class theClass)`
`static
`<E> List<E>`
` | `newList(E object)` Return a `List` (actually an `ArrayList`) with only that object.
`static
`<E> Set<E>`
` | `newSet(E 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

### isCollection

    public static boolean isCollection(Class theClass)

### isMap

    public static boolean isMap(Class theClass)

### add

    public static <E> Set<E> add(Set<E> set,
                                 E object)

  Add an object to a `Set` and return the result.

  Parameters:
    `set` -
    `object` -
  Returns:

### add

    public static <E> List<E> add(List<E> list,
                                  E object)

  Add an object to a `List` and return the result.

  Parameters:
    `list` -
    `object` -
  Returns:

### clone

    public static <E> Collection<E> clone(Collection<E> collection)

  Clone a Collection copying all its elements to a new one. If map is `null` return `null`.

  Parameters:
    `collection` -
  Returns:
  Throws:
    `IllegalArgumentException` - DOCUMENT ME!

### clone

    public static <K,V> Map<K,V> clone(Map<K,V> map)

  Clone a `Map` copying all its elements to a new one. If the passed argument is `null`, the method will return `null`.

  Parameters:
    `map` - to copy
  Returns:
    a copy of the `Map` passed as an argument
  Throws:
    `IllegalArgumentException` - if the `Map` implementation is not supported by this method

### newList

    public static <E> List<E> newList(E object)

  Return a `List` (actually an `ArrayList`) with only that object.

  Parameters:
    `object` -
  Returns:

### newSet

    public static <E> Set<E> newSet(E object)

  Return a `Set` (actually a `HashSet`) with only that object.

  Parameters:
    `object` -
  Returns:

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2005 Acegi Technology Pty Limited. All Rights Reserved.