Package com.tangosol.util
Class NullImplementation.NullSet
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet
com.tangosol.util.NullImplementation.NullSet
- All Implemented Interfaces:
ExternalizableLite,PortableObject,Serializable,Iterable,Collection,Set
- Enclosing class:
- NullImplementation
public static class NullImplementation.NullSet
extends AbstractSet
implements Serializable, ExternalizableLite, PortableObject
An immutable set which contains nothing.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanEnsures that this Collection contains the specified element.voidclear()Removes all of the elements from this Collection.booleanReturns true if this Collection contains the specified element.booleaninthashCode()iterator()Returns an Iterator over the elements contained in this Collection.voidRestore the contents of a user type instance by reading its state using the specified PofReader object.voidRestore the contents of this object by loading the object's state from the passed DataInput object.booleanRemoves a single instance of the specified element from this Collection, if it is present (optional operation).intsize()Returns the number of elements in this Collection.Object[]toArray()Returns an array containing all of the elements in this Set.voidwriteExternal(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object.voidwriteExternal(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.Methods inherited from class java.util.AbstractSet
removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, containsAll, isEmpty, retainAll, spliterator, toArray
-
Field Details
-
INSTANCE
Since the set contains no information, only one ever has to exist.
-
-
Constructor Details
-
NullSet
public NullSet()Default constructor (for ExternalizableLite and PortableObject).
-
-
Method Details
-
toArray
Returns an array containing all of the elements in this Set. Obeys the general contract of Collection.toArray.- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceSet- Overrides:
toArrayin classAbstractCollection- Returns:
- an Object array containing all of the elements in this Set
-
iterator
Returns an Iterator over the elements contained in this Collection.- Specified by:
iteratorin interfaceCollection- Specified by:
iteratorin interfaceIterable- Specified by:
iteratorin interfaceSet- Specified by:
iteratorin classAbstractCollection- Returns:
- an Iterator over the elements contained in this Collection
-
size
public int size()Returns the number of elements in this Collection.- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceSet- Specified by:
sizein classAbstractCollection- Returns:
- the number of elements in this Collection
-
contains
Returns true if this Collection contains the specified element. More formally, returns true if and only if this Collection contains at least one elementesuch that(o==null ? e==null : o.equals(e)).- Specified by:
containsin interfaceCollection- Specified by:
containsin interfaceSet- Overrides:
containsin classAbstractCollection- Parameters:
o- the object to search for in the set- Returns:
- true if this set contains the specified object
-
add
Ensures that this Collection contains the specified element.- Specified by:
addin interfaceCollection- Specified by:
addin interfaceSet- Overrides:
addin classAbstractCollection- Parameters:
o- element whose presence in this Collection is to be ensured- Returns:
- true if the Collection changed as a result of the call
-
remove
Removes a single instance of the specified element from this Collection, if it is present (optional operation). More formally, removes an elementesuch that(o==null ? e==null : o.equals(e)), if the Collection contains one or more such elements. Returns true if the Collection contained the specified element (or equivalently, if the Collection changed as a result of the call).- Specified by:
removein interfaceCollection- Specified by:
removein interfaceSet- Overrides:
removein classAbstractCollection- Parameters:
o- element to be removed from this Collection, if present- Returns:
- true if the Collection contained the specified element
-
clear
public void clear()Removes all of the elements from this Collection.- Specified by:
clearin interfaceCollection- Specified by:
clearin interfaceSet- Overrides:
clearin classAbstractCollection
-
equals
- Specified by:
equalsin interfaceCollection- Specified by:
equalsin interfaceSet- Overrides:
equalsin classAbstractSet
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection- Specified by:
hashCodein interfaceSet- Overrides:
hashCodein classAbstractSet
-
readExternal
Restore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternalin interfaceExternalizableLite- Parameters:
in- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException- if an I/O exception occursNotActiveException- if the object is not in its initial state, and therefore cannot be deserialized into
-
writeExternal
Save the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternalin interfaceExternalizableLite- Parameters:
out- the DataOutput stream to write the state of this object to- Throws:
IOException- if an I/O exception occurs
-
readExternal
Restore the contents of a user type instance by reading its state using the specified PofReader object.- Specified by:
readExternalin interfacePortableObject- Parameters:
in- the PofReader from which to read the object's state- Throws:
IOException- if an I/O error occurs
-
writeExternal
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.- Specified by:
writeExternalin interfacePortableObject- Parameters:
out- the PofWriter to which to write the object's state- Throws:
IOException- if an I/O error occurs
-