Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Class NullImplementation.NullSet

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractSet
          extended by com.tangosol.util.NullImplementation.NullSet

All Implemented Interfaces:
ExternalizableLite, PortableObject, java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.Set
Enclosing class:
NullImplementation

public static class NullImplementation.NullSet
extends java.util.AbstractSet
implements java.io.Serializable, ExternalizableLite, PortableObject

An immutable set which contains nothing.


Field Summary
static java.util.Set INSTANCE
          Since the set contains no information, only one ever has to exist.

 

Constructor Summary
NullImplementation.NullSet()
          Default constructor (for ExternalizableLite and PortableObject).

 

Method Summary
 boolean add(java.lang.Object o)
          Ensures that this Collection contains the specified element.
 void clear()
          Removes all of the elements from this Collection.
 boolean contains(java.lang.Object o)
          Returns true if this Collection contains the specified element.
 boolean equals(java.lang.Object o)
          
 int hashCode()
          
 java.util.Iterator iterator()
          Returns an Iterator over the elements contained in this Collection.
 void readExternal(java.io.DataInput in)
          Restore the contents of this object by loading the object's state from the passed DataInput object.
 void readExternal(PofReader in)
          Restore the contents of a user type instance by reading its state using the specified PofReader object.
 boolean remove(java.lang.Object o)
          Removes a single instance of the specified element from this Collection, if it is present (optional operation).
 int size()
          Returns the number of elements in this Collection.
 java.lang.Object[] toArray()
          Returns an array containing all of the elements in this Set.
 void writeExternal(java.io.DataOutput out)
          Save the contents of this object by storing the object's state into the passed DataOutput object.
 void writeExternal(PofWriter out)
          Save the contents of a POF user type instance by writing its state using the specified PofWriter object.

 

Methods inherited from class java.util.AbstractSet
removeAll

 

Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toString

 

Methods inherited from interface java.util.Set
addAll, containsAll, isEmpty, retainAll, toArray

 

Field Detail

INSTANCE

public static final java.util.Set INSTANCE
Since the set contains no information, only one ever has to exist.

Constructor Detail

NullImplementation.NullSet

public NullImplementation.NullSet()
Default constructor (for ExternalizableLite and PortableObject).

Method Detail

toArray

public java.lang.Object[] toArray()
Returns an array containing all of the elements in this Set. Obeys the general contract of Collection.toArray.
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Overrides:
toArray in class java.util.AbstractCollection
Returns:
an Object array containing all of the elements in this Set

iterator

public java.util.Iterator iterator()
Returns an Iterator over the elements contained in this Collection.
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Specified by:
iterator in class java.util.AbstractCollection
Returns:
an Iterator over the elements contained in this Collection

size

public int size()
Returns the number of elements in this Collection.
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Specified by:
size in class java.util.AbstractCollection
Returns:
the number of elements in this Collection

contains

public boolean contains(java.lang.Object o)
Returns true if this Collection contains the specified element. More formally, returns true if and only if this Collection contains at least one element e such that (o==null ? e==null : o.equals(e)).
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class java.util.AbstractCollection
Parameters:
o - the object to search for in the set
Returns:
true if this set contains the specified object

add

public boolean add(java.lang.Object o)
Ensures that this Collection contains the specified element.
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.AbstractCollection
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

public boolean remove(java.lang.Object o)
Removes a single instance of the specified element from this Collection, if it is present (optional operation). More formally, removes an element e such 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:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class java.util.AbstractCollection
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:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Overrides:
clear in class java.util.AbstractCollection

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.Set
Overrides:
equals in class java.util.AbstractSet

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class java.util.AbstractSet

readExternal

public void readExternal(java.io.DataInput in)
                  throws java.io.IOException
Restore the contents of this object by loading the object's state from the passed DataInput object.
Specified by:
readExternal in interface ExternalizableLite
Parameters:
in - the DataInput stream to read data from in order to restore the state of this object
Throws:
java.io.IOException - if an I/O exception occurs
java.io.NotActiveException - if the object is not in its initial state, and therefore cannot be deserialized into

writeExternal

public void writeExternal(java.io.DataOutput out)
                   throws java.io.IOException
Save the contents of this object by storing the object's state into the passed DataOutput object.
Specified by:
writeExternal in interface ExternalizableLite
Parameters:
out - the DataOutput stream to write the state of this object to
Throws:
java.io.IOException - if an I/O exception occurs

readExternal

public void readExternal(PofReader in)
                  throws java.io.IOException
Restore the contents of a user type instance by reading its state using the specified PofReader object.
Specified by:
readExternal in interface PortableObject
Parameters:
in - the PofReader from which to read the object's state
Throws:
java.io.IOException - if an I/O error occurs

writeExternal

public void writeExternal(PofWriter out)
                   throws java.io.IOException
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
Specified by:
writeExternal in interface PortableObject
Parameters:
out - the PofWriter to which to write the object's state
Throws:
java.io.IOException - if an I/O error occurs

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.