EnumSetWritable (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.io, class: EnumSetWritable

Package org.apache.hadoop.io

# Class EnumSetWritable<E extends Enum<E>>

java.lang.Object
java.util.AbstractCollection<E>
org.apache.hadoop.io.EnumSetWritable<E>

All Implemented Interfaces:
  `Iterable<E>`, `Collection<E>`, `Configurable`, `Writable`

@Public @Stable public class EnumSetWritable<E extends Enum<E>> extends AbstractCollection<E> implements Writable, Configurable
A Writable wrapper for EnumSet.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EnumSetWritable(EnumSet<E> value)`
  Construct a new EnumSetWritable.
  `EnumSetWritable(EnumSet<E> value, Class<E> elementType)`
  Construct a new EnumSetWritable.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(E e)`
  `boolean`
  `equals(Object o)`
  Returns true if `o` is an EnumSetWritable with the same value, or both are null.
  `EnumSet<E>`
  `get()`
  Return the value of this EnumSetWritable.
  `Configuration`
  `getConf()`
  Return the configuration used by this object.
  `Class<E>`
  `getElementType()`
  Returns the class of all the elements of the underlying EnumSetWriable.
  `int`
  `hashCode()`
  `Iterator<E>`
  `iterator()`
  `void`
  `readFields(DataInput in)`
  Deserialize the fields of this object from `in`.
  `void`
  `set(EnumSet<E> value, Class<E> elementType)`
  reset the EnumSetWritable with specified `value` and `elementType`.
  `void`
  `setConf(Configuration conf)`
  Set the configuration to be used by this object.
  `int`
  `size()`
  `String`
  `toString()`
  `void`
  `write(DataOutput out)`
  Serialize the fields of this object to `out`.

  ### Methods inherited from class java.util.AbstractCollection

  `addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.util.Collection

  `parallelStream, removeIf, spliterator, stream, toArray`

  ### Methods inherited from interface java.lang.Iterable

  `forEach`

- ## Constructor Details

  - ### EnumSetWritable

    public EnumSetWritable(EnumSet<E> value, Class<E> elementType)
    Construct a new EnumSetWritable. If the `value` argument is null or its size is zero, the `elementType` argument must not be null. If the argument `value`'s size is bigger than zero, the argument `elementType` is not be used.
    Parameters:
      `value` - enumSet value.
      `elementType` - elementType.

  - ### EnumSetWritable

    public EnumSetWritable(EnumSet<E> value)
    Construct a new EnumSetWritable. Argument `value` should not be null or empty.
    Parameters:
      `value` - enumSet value.

- ## Method Details

  - ### iterator

    public Iterator<E> iterator()
    Specified by:
      `iterator` in interface `Collection<E extends Enum<E>>`
    Specified by:
      `iterator` in interface `Iterable<E extends Enum<E>>`
    Specified by:
      `iterator` in class `AbstractCollection<E extends Enum<E>>`

  - ### size

    public int size()
    Specified by:
      `size` in interface `Collection<E extends Enum<E>>`
    Specified by:
      `size` in class `AbstractCollection<E extends Enum<E>>`

  - ### add

    public boolean add(E e)
    Specified by:
      `add` in interface `Collection<E extends Enum<E>>`
    Overrides:
      `add` in class `AbstractCollection<E extends Enum<E>>`

  - ### set

    public void set(EnumSet<E> value, Class<E> elementType)
    reset the EnumSetWritable with specified `value` and `elementType`. If the `value` argument is null or its size is zero, the `elementType` argument must not be null. If the argument `value`'s size is bigger than zero, the argument `elementType` is not be used.
    Parameters:
      `value` - enumSet Value.
      `elementType` - elementType.

  - ### get

    public EnumSet<E> get()
    Return the value of this EnumSetWritable.
    Returns:
      EnumSet.

  - ### readFields

    public void readFields(DataInput in) throws IOException
    Description copied from interface: `Writable`
    Deserialize the fields of this object from `in`.

    For efficiency, implementations should attempt to re-use storage in the existing object where possible.

    Specified by:
      `readFields` in interface `Writable`
    Parameters:
      `in` - `DataInput` to deseriablize this object from.
    Throws:
      `IOException` - any other problem for readFields.

  - ### write

    public void write(DataOutput out) throws IOException
    Description copied from interface: `Writable`
    Serialize the fields of this object to `out`.
    Specified by:
      `write` in interface `Writable`
    Parameters:
      `out` - `DataOuput` to serialize this object into.
    Throws:
      `IOException` - any other problem for write.

  - ### equals

    public boolean equals(Object o)
    Returns true if `o` is an EnumSetWritable with the same value, or both are null.
    Specified by:
      `equals` in interface `Collection<E extends Enum<E>>`
    Overrides:
      `equals` in class `Object`

  - ### getElementType

    public Class<E> getElementType()
    Returns the class of all the elements of the underlying EnumSetWriable. It may return null.
    Returns:
      the element class

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in interface `Collection<E extends Enum<E>>`
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `AbstractCollection<E extends Enum<E>>`

  - ### getConf

    public Configuration getConf()
    Description copied from interface: `Configurable`
    Return the configuration used by this object.
    Specified by:
      `getConf` in interface `Configurable`
    Returns:
      Configuration

  - ### setConf

    public void setConf(Configuration conf)
    Description copied from interface: `Configurable`
    Set the configuration to be used by this object.
    Specified by:
      `setConf` in interface `Configurable`
    Parameters:
      `conf` - configuration to be used