Oracle® XML Java API Reference
Release 1 (10.1)

B12024-01

oracle.soap.providers.sp
Class Hashset

java.lang.Object
  |
  +--oracle.soap.providers.sp.Hashset
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class Hashset
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Hashset is a simple set container built on top of Hashtable. Its is indexed by a key which should satisfy all the requirements for Hashtable keys.

Hashset internally uses a Hashtable to store items. All methods of the class are indirectly synchronized and, hence, multi-thread safe.

See Also:
Serialized Form

Constructor Summary
Hashset()
           Construct an empty set.
Hashset(Hashset s)
           Create a copy of an existing set.

 

Method Summary
 void clear()
           Clear the set.
 java.lang.Object clone()
           Clone the hash set (by invoking the copy constructor).
 boolean contains(java.lang.Object v)
           Check if the set contains the specified element.
 java.util.Enumeration elements()
           Return an enumeration of the elements in the set.
 java.lang.Object getAny()
           Get a random element in the set.
 boolean isEmpty()
           Check if the set is empty.
 void put(java.lang.Object v)
           Add the given element to the set.
 void remove(java.lang.Object v)
           Remove the item from the set.
 int size()
           Return the size of the set.

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Hashset

public Hashset()

Construct an empty set.


Hashset

public Hashset(Hashset s)

Create a copy of an existing set. The internal table is cloned. If the provided set is null, construct an empty set.

Parameters:
s - the set to create copy from.
Method Detail

clone

public java.lang.Object clone()

Clone the hash set (by invoking the copy constructor).

Overrides:
clone in class java.lang.Object

size

public int size()

Return the size of the set.

Returns:
the number of elements in the set.

isEmpty

public boolean isEmpty()

Check if the set is empty.

Returns:
true iff the set if empty.

elements

public java.util.Enumeration elements()

Return an enumeration of the elements in the set.

Returns:
the elements in the set as an enumeration.

contains

public boolean contains(java.lang.Object v)

Check if the set contains the specified element.

Returns:
true iff the item is in the set.
Throws:
java.lang.NullPointerException - if the item is null.

put

public void put(java.lang.Object v)

Add the given element to the set.

Parameters:
v - the item to add to the set.
Throws:
java.lang.NullPointerException - if the item is null.

remove

public void remove(java.lang.Object v)

Remove the item from the set.

Parameters:
v - the item to add to the set.
Throws:
java.lang.NullPointerException - if the item is null.

clear

public void clear()

Clear the set.


getAny

public java.lang.Object getAny()

Get a random element in the set. The element returned is not quite random; it is the first element in the internal enumeration generated for this set.

If the set is empty, a null is returned.

Returns:
any element in the set, or null if the set is empty.

Oracle® XML Java API Reference
Release 1 (10.1)

B12024-01

Copyright © 2003, Oracle. All Rights Reserved.