RegularEnumSet

class RegularEnumSet<E : Enum<E>>(elementType: KClass<E>, universe: Array<Enum<E>>) : EnumSet<E>

Private implementation class for EnumSet, for "regular sized" enum types (i.e., those with 64 or fewer enum constants).

Author

Josh Bloch

Since

1.5

Constructors

Link copied to clipboard
constructor(elementType: KClass<E>, universe: Array<Enum<E>>)

Properties

Link copied to clipboard

The class of all the elements of this set.

Link copied to clipboard
open override val size: Int

Returns the number of elements in this set.

Link copied to clipboard

All of the values comprising E. (Cached for performance.)

Functions

Link copied to clipboard
open override fun add(element: E): Boolean

Adds the specified element to this set if it is not already present.

Link copied to clipboard
open override fun addAll()

Adds all of the elements from the appropriate enum type to this enum set, which is empty prior to the call.

open override fun addAll(elements: Collection<E>): Boolean

Adds all of the elements in the specified collection to this set.

Link copied to clipboard
open override fun addRange(from: E, to: E)

Adds the specified range to this enum set, which is empty prior to the call.

Link copied to clipboard
open override fun clear()

Removes all of the elements from this set.

Link copied to clipboard
open override fun clone(): EnumSet<E>

Returns a copy of this set.

Link copied to clipboard
open override fun complement()

Complements the contents of this enum set.

Link copied to clipboard
open operator override fun contains(element: E): Boolean

Returns true if this set contains the specified element.

Link copied to clipboard
open override fun containsAll(elements: Collection<E>): Boolean

Returns true if this set contains all of the elements in the specified collection.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compares the specified object with this set for equality. Returns true if the given object is also a set, the two sets have the same size, and every member of the given set is contained in this set.

Link copied to clipboard
open override fun isEmpty(): Boolean

Returns true if this set contains no elements.

Link copied to clipboard
open operator override fun iterator(): MutableIterator<E>

Returns an iterator over the elements contained in this set. The iterator traverses the elements in their natural order (which is the order in which the enum constants are declared). The returned Iterator is a "snapshot" iterator that will never throw [ ]; the elements are traversed as they existed when this call was invoked.

Link copied to clipboard
open override fun remove(element: E): Boolean

Removes the specified element from this set if it is present.

Link copied to clipboard
open override fun removeAll(elements: Collection<E>): Boolean

Removes from this set all of its elements that are contained in the specified collection.

Link copied to clipboard
open override fun retainAll(elements: Collection<E>): Boolean

Retains only the elements in this set that are contained in the specified collection.