choco.kernel.common.util.tools
Class CollectionUtils

java.lang.Object
  extended by choco.kernel.common.util.tools.CollectionUtils

public final class CollectionUtils
extends Object

At the contrary of collections in the class Collections, these collections do not throw any access exception

Since:
10 févr. 2010 version 2.1.1
Version:
2.1.1
Author:
Arnaud Malapert

Field Summary
static List EMPTY_LIST
          The empty list (immutable but does not throw any exception).
static Set EMPTY_SET
          The empty set (immutable).
 
Method Summary
static
<T> List<T>
emptyList()
          Returns the empty list (immutable).
static
<T> Set<T>
emptySet()
          Returns the empty set (immutable).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_SET

public static final Set EMPTY_SET
The empty set (immutable). This set is serializable.

See Also:
emptySet()

EMPTY_LIST

public static final List EMPTY_LIST
The empty list (immutable but does not throw any exception). This list is serializable.

See Also:
emptyList()
Method Detail

emptySet

public static final <T> Set<T> emptySet()
Returns the empty set (immutable). This set is serializable. Unlike the like-named field, this method is parameterized.

This example illustrates the type-safe way to obtain an empty set:

     Set<String> s = Collections.emptySet();
 
Implementation note: Implementations of this method need not create a separate Set object for each call. Using this method is likely to have comparable cost to using the like-named field. (Unlike this method, the field does not provide type safety.)

Since:
1.5
See Also:
EMPTY_SET

emptyList

public static <T> List<T> emptyList()
Returns the empty list (immutable). This list is serializable.

This example illustrates the type-safe way to obtain an empty list:

     List<String> s = Collections.emptyList();
 
Implementation note: Implementations of this method need not create a separate List object for each call. Using this method is likely to have comparable cost to using the like-named field. (Unlike this method, the field does not provide type safety.)

Since:
1.5
See Also:
EMPTY_LIST


Copyright © 2012. All Rights Reserved.