com.google.common.collect.testing.features
Enum CollectionFeature

java.lang.Object
  extended by java.lang.Enum<CollectionFeature>
      extended by com.google.common.collect.testing.features.CollectionFeature
All Implemented Interfaces:
Feature<Collection>, Serializable, Comparable<CollectionFeature>

public enum CollectionFeature
extends Enum<CollectionFeature>
implements Feature<Collection>

Optional features of classes derived from Collection.

This class is GWT compatible.

Author:
George van den Driessche

Nested Class Summary
static interface CollectionFeature.Require
           
 
Enum Constant Summary
ALLOWS_NULL_QUERIES
          The collection must not throw NullPointerException on calls such as contains(null) or remove(null), but instead must return a simple false.
ALLOWS_NULL_VALUES
           
GENERAL_PURPOSE
          Features supported by general-purpose collections - everything but RESTRICTS_ELEMENTS.
KNOWN_ORDER
          Indicates that a collection has a well-defined ordering of its elements.
NON_STANDARD_TOSTRING
          Indicates that a collection has a different Object.toString() representation than most collections.
NONE
          For documenting collections that support no optional features, such as Collections.emptySet()
REJECTS_DUPLICATES_AT_CREATION
          Indicates that the constructor or factory method of a collection, usually an immutable set, throws an IllegalArgumentException when presented with duplicate elements instead of collapsing them to a single element or including duplicate instances in the collection.
REMOVE_OPERATIONS
          Features supported by collections where only removal is allowed.
RESTRICTS_ELEMENTS
          Indicates that a collection disallows certain elements (other than null, whose validity as an element is indicated by the presence or absence of ALLOWS_NULL_VALUES).
SUPPORTS_ADD
           
SUPPORTS_ADD_ALL
           
SUPPORTS_CLEAR
           
SUPPORTS_REMOVE
           
SUPPORTS_REMOVE_ALL
           
SUPPORTS_RETAIN_ALL
           
 
Method Summary
 Set<Feature<? super Collection>> getImpliedFeatures()
          Returns the set of features that are implied by this feature.
static CollectionFeature valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CollectionFeature[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ALLOWS_NULL_QUERIES

public static final CollectionFeature ALLOWS_NULL_QUERIES
The collection must not throw NullPointerException on calls such as contains(null) or remove(null), but instead must return a simple false.


ALLOWS_NULL_VALUES

public static final CollectionFeature ALLOWS_NULL_VALUES

RESTRICTS_ELEMENTS

public static final CollectionFeature RESTRICTS_ELEMENTS
Indicates that a collection disallows certain elements (other than null, whose validity as an element is indicated by the presence or absence of ALLOWS_NULL_VALUES). From the documentation for Collection:
"Some collection implementations have restrictions on the elements that they may contain. For example, some implementations prohibit null elements, and some have restrictions on the types of their elements."


KNOWN_ORDER

public static final CollectionFeature KNOWN_ORDER
Indicates that a collection has a well-defined ordering of its elements. The ordering may depend on the element values, such as a SortedSet, or on the insertion ordering, such as a LinkedHashSet. All list tests automatically specify this feature.


NON_STANDARD_TOSTRING

public static final CollectionFeature NON_STANDARD_TOSTRING
Indicates that a collection has a different Object.toString() representation than most collections. If not specified, the collection tests will examine the value returned by Object.toString().


REJECTS_DUPLICATES_AT_CREATION

public static final CollectionFeature REJECTS_DUPLICATES_AT_CREATION
Indicates that the constructor or factory method of a collection, usually an immutable set, throws an IllegalArgumentException when presented with duplicate elements instead of collapsing them to a single element or including duplicate instances in the collection.


SUPPORTS_ADD

public static final CollectionFeature SUPPORTS_ADD

SUPPORTS_REMOVE

public static final CollectionFeature SUPPORTS_REMOVE

SUPPORTS_ADD_ALL

public static final CollectionFeature SUPPORTS_ADD_ALL

SUPPORTS_REMOVE_ALL

public static final CollectionFeature SUPPORTS_REMOVE_ALL

SUPPORTS_RETAIN_ALL

public static final CollectionFeature SUPPORTS_RETAIN_ALL

SUPPORTS_CLEAR

public static final CollectionFeature SUPPORTS_CLEAR

GENERAL_PURPOSE

public static final CollectionFeature GENERAL_PURPOSE
Features supported by general-purpose collections - everything but RESTRICTS_ELEMENTS.

See Also:
the definition of general-purpose collections.

REMOVE_OPERATIONS

public static final CollectionFeature REMOVE_OPERATIONS
Features supported by collections where only removal is allowed.


NONE

public static final CollectionFeature NONE
For documenting collections that support no optional features, such as Collections.emptySet()

Method Detail

values

public static CollectionFeature[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CollectionFeature c : CollectionFeature.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CollectionFeature valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getImpliedFeatures

public Set<Feature<? super Collection>> getImpliedFeatures()
Description copied from interface: Feature
Returns the set of features that are implied by this feature.

Specified by:
getImpliedFeatures in interface Feature<Collection>


Copyright © 2010-2011. All Rights Reserved.