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
ConstructorsConstructorDescriptionEnumSetWritable(EnumSet<E> value) Construct a new EnumSetWritable.EnumSetWritable(EnumSet<E> value, Class<E> elementType) Construct a new EnumSetWritable. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanReturns true ifois an EnumSetWritable with the same value, or both are null.get()Return the value of this EnumSetWritable.getConf()Return the configuration used by this object.Returns the class of all the elements of the underlying EnumSetWriable.inthashCode()iterator()voidreadFields(DataInput in) Deserialize the fields of this object fromin.voidreset the EnumSetWritable with specifiedvalueandelementType.voidsetConf(Configuration conf) Set the configuration to be used by this object.intsize()toString()voidwrite(DataOutput out) Serialize the fields of this object toout.Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
EnumSetWritable
Construct a new EnumSetWritable. If thevalueargument is null or its size is zero, theelementTypeargument must not be null. If the argumentvalue's size is bigger than zero, the argumentelementTypeis not be used.- Parameters:
value- enumSet value.elementType- elementType.
-
EnumSetWritable
Construct a new EnumSetWritable. Argumentvalueshould not be null or empty.- Parameters:
value- enumSet value.
-
-
Method Details
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<E extends Enum<E>>- Specified by:
sizein classAbstractCollection<E extends Enum<E>>
-
add
- Specified by:
addin interfaceCollection<E extends Enum<E>>- Overrides:
addin classAbstractCollection<E extends Enum<E>>
-
set
reset the EnumSetWritable with specifiedvalueandelementType. If thevalueargument is null or its size is zero, theelementTypeargument must not be null. If the argumentvalue's size is bigger than zero, the argumentelementTypeis not be used.- Parameters:
value- enumSet Value.elementType- elementType.
-
get
Return the value of this EnumSetWritable.- Returns:
- EnumSet.
-
readFields
Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-
write
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
equals
Returns true ifois an EnumSetWritable with the same value, or both are null. -
getElementType
Returns the class of all the elements of the underlying EnumSetWriable. It may return null.- Returns:
- the element class
-
hashCode
public int hashCode() -
toString
- Overrides:
toStringin classAbstractCollection<E extends Enum<E>>
-
getConf
Description copied from interface:ConfigurableReturn the configuration used by this object.- Specified by:
getConfin interfaceConfigurable- Returns:
- Configuration
-
setConf
Description copied from interface:ConfigurableSet the configuration to be used by this object.- Specified by:
setConfin interfaceConfigurable- Parameters:
conf- configuration to be used
-