Enum CollectionFeature
- All Implemented Interfaces:
Feature<Collection>
,Serializable
,Comparable<CollectionFeature>
,java.lang.constant.Constable
@GwtCompatible
public enum CollectionFeature
extends Enum<CollectionFeature>
implements Feature<Collection>
Optional features of classes derived from
Collection
.- Author:
- George van den Driessche
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe collection must not throwNullPointerException
on calls such ascontains(null)
orremove(null)
, but instead must return a simplefalse
.Features supported by general-purpose collections - everything butRESTRICTS_ELEMENTS
.Indicates that a collection has a well-defined ordering of its elements.Indicates that a collection has a differentObject.toString()
representation than most collections.For documenting collections that support no optional features, such asCollections.emptySet()
Indicates that the constructor or factory method of a collection, usually an immutable set, throws anIllegalArgumentException
when presented with duplicate elements instead of collapsing them to a single element or including duplicate instances in the collection.Features supported by collections where only removal is allowed.Indicates that a collection disallows certain elements (other thannull
, whose validity as an element is indicated by the presence or absence ofALLOWS_NULL_VALUES
). -
Method Summary
Modifier and TypeMethodDescriptionSet
<Feature<? super Collection>> Returns the set of features that are implied by this feature.static CollectionFeature
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.
-
Enum Constant Details
-
ALLOWS_NULL_QUERIES
The collection must not throwNullPointerException
on calls such ascontains(null)
orremove(null)
, but instead must return a simplefalse
. -
ALLOWS_NULL_VALUES
-
RESTRICTS_ELEMENTS
Indicates that a collection disallows certain elements (other thannull
, whose validity as an element is indicated by the presence or absence ofALLOWS_NULL_VALUES
). From the documentation forCollection
:"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
Indicates that a collection has a well-defined ordering of its elements. The ordering may depend on the element values, such as aSortedSet
, or on the insertion ordering, such as aLinkedHashSet
. All list tests and sorted-collection tests automatically specify this feature. -
NON_STANDARD_TOSTRING
Indicates that a collection has a differentObject.toString()
representation than most collections. If not specified, the collection tests will examine the value returned byObject.toString()
. -
REJECTS_DUPLICATES_AT_CREATION
Indicates that the constructor or factory method of a collection, usually an immutable set, throws anIllegalArgumentException
when presented with duplicate elements instead of collapsing them to a single element or including duplicate instances in the collection. -
SUPPORTS_ADD
-
SUPPORTS_REMOVE
-
SUPPORTS_ITERATOR_REMOVE
-
FAILS_FAST_ON_CONCURRENT_MODIFICATION
-
GENERAL_PURPOSE
Features supported by general-purpose collections - everything butRESTRICTS_ELEMENTS
.- See Also:
-
REMOVE_OPERATIONS
Features supported by collections where only removal is allowed. -
SERIALIZABLE
-
SERIALIZABLE_INCLUDING_VIEWS
-
SUBSET_VIEW
-
DESCENDING_VIEW
-
NONE
For documenting collections that support no optional features, such asCollections.emptySet()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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 nameNullPointerException
- if the argument is null
-
getImpliedFeatures
Description copied from interface:Feature
Returns the set of features that are implied by this feature.- Specified by:
getImpliedFeatures
in interfaceFeature<Collection>
-