@GwtCompatible public enum CollectionFeature extends Enum<CollectionFeature> implements Feature<Collection>
Collection
.Modifier and Type | Class and Description |
---|---|
static interface |
CollectionFeature.Require |
Enum Constant and Description |
---|
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 |
DESCENDING_VIEW |
FAILS_FAST_ON_CONCURRENT_MODIFICATION |
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 ). |
SERIALIZABLE |
SERIALIZABLE_INCLUDING_VIEWS |
SUBSET_VIEW |
SUPPORTS_ADD |
SUPPORTS_ITERATOR_REMOVE |
SUPPORTS_REMOVE |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final CollectionFeature ALLOWS_NULL_QUERIES
NullPointerException
on calls
such as contains(null)
or remove(null)
, but instead
must return a simple false
.public static final CollectionFeature ALLOWS_NULL_VALUES
public static final CollectionFeature RESTRICTS_ELEMENTS
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."
public static final CollectionFeature KNOWN_ORDER
SortedSet
,
or on the insertion ordering, such as a LinkedHashSet
. All list
tests and sorted-collection tests automatically specify this feature.public static final CollectionFeature NON_STANDARD_TOSTRING
Object.toString()
representation than most collections. If not specified, the collection
tests will examine the value returned by Object.toString()
.public static final CollectionFeature REJECTS_DUPLICATES_AT_CREATION
IllegalArgumentException
when presented
with duplicate elements instead of collapsing them to a single element or
including duplicate instances in the collection.public static final CollectionFeature SUPPORTS_ADD
public static final CollectionFeature SUPPORTS_REMOVE
public static final CollectionFeature SUPPORTS_ITERATOR_REMOVE
public static final CollectionFeature FAILS_FAST_ON_CONCURRENT_MODIFICATION
public static final CollectionFeature GENERAL_PURPOSE
RESTRICTS_ELEMENTS
.public static final CollectionFeature REMOVE_OPERATIONS
public static final CollectionFeature SERIALIZABLE
public static final CollectionFeature SERIALIZABLE_INCLUDING_VIEWS
public static final CollectionFeature SUBSET_VIEW
public static final CollectionFeature DESCENDING_VIEW
public static final CollectionFeature NONE
Collections.emptySet()
public static CollectionFeature[] values()
for (CollectionFeature c : CollectionFeature.values()) System.out.println(c);
public static CollectionFeature valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant
with the specified nameNullPointerException
- if the argument is nullpublic Set<Feature<? super Collection>> getImpliedFeatures()
Feature
getImpliedFeatures
in interface Feature<Collection>
Copyright © 2010-2016. All Rights Reserved.