Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.adfnmc.java.util
Class HashSet

java.lang.Object
  extended by oracle.adfnmc.java.util.AbstractCollection
      extended by oracle.adfnmc.java.util.AbstractSet
          extended by oracle.adfnmc.java.util.HashSet
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, Set

public class HashSet
extends AbstractSet
implements Set, Cloneable, Serializable

HashSet is an implementation of Set. All optional operations are supported, adding and removing. The elements can be any objects.


Constructor Summary
HashSet()
          Constructs a new empty instance of HashSet.
HashSet(Collection collection)
          Constructs a new instance of HashSet containing the unique elements in the specified collection.
HashSet(int capacity)
          Constructs a new instance of HashSet with the specified capacity.
HashSet(int capacity, float loadFactor)
          Constructs a new instance of HashSet with the specified capacity and load factor.
 
Method Summary
 boolean add(java.lang.Object object)
          Adds the specified object to this HashSet.
 void clear()
          Removes all elements from this HashSet, leaving it empty.
 java.lang.Object clone()
          Answers a new HashSet with the same elements and size as this HashSet.
 boolean contains(java.lang.Object object)
          Searches this HashSet for the specified object.
 boolean isEmpty()
          Answers if this HashSet has no elements, a size of zero.
 Iterator iterator()
          Answers an Iterator on the elements of this HashSet.
 boolean remove(java.lang.Object object)
          Removes an occurrence of the specified object from this HashSet.
 int size()
          Answers the number of elements in this HashSet.
 
Methods inherited from class oracle.adfnmc.java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class oracle.adfnmc.java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.adfnmc.java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

HashSet

public HashSet()
Constructs a new empty instance of HashSet.


HashSet

public HashSet(int capacity)
Constructs a new instance of HashSet with the specified capacity.

Parameters:
capacity - the initial capacity of this HashSet

HashSet

public HashSet(int capacity,
               float loadFactor)
Constructs a new instance of HashSet with the specified capacity and load factor.

Parameters:
capacity - the initial capacity
loadFactor - the initial load factor

HashSet

public HashSet(Collection collection)
Constructs a new instance of HashSet containing the unique elements in the specified collection.

Parameters:
collection - the collection of elements to add
Method Detail

add

public boolean add(java.lang.Object object)
Adds the specified object to this HashSet.

Specified by:
add in interface Collection
Specified by:
add in interface Set
Overrides:
add in class AbstractCollection
Parameters:
object - the object to add
Returns:
true when this HashSet did not already contain the object, false otherwise

clear

public void clear()
Removes all elements from this HashSet, leaving it empty.

Specified by:
clear in interface Collection
Specified by:
clear in interface Set
Overrides:
clear in class AbstractCollection
See Also:
isEmpty(), size()

clone

public java.lang.Object clone()
Answers a new HashSet with the same elements and size as this HashSet.

Returns:
a shallow copy of this HashSet
See Also:
Cloneable

contains

public boolean contains(java.lang.Object object)
Searches this HashSet for the specified object.

Specified by:
contains in interface Collection
Specified by:
contains in interface Set
Overrides:
contains in class AbstractCollection
Parameters:
object - the object to search for
Returns:
true if object is an element of this HashSet, false otherwise

isEmpty

public boolean isEmpty()
Answers if this HashSet has no elements, a size of zero.

Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface Set
Overrides:
isEmpty in class AbstractCollection
Returns:
true if this HashSet has no elements, false otherwise
See Also:
size()

iterator

public Iterator iterator()
Answers an Iterator on the elements of this HashSet.

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface Set
Specified by:
iterator in class AbstractCollection
Returns:
an Iterator on the elements of this HashSet
See Also:
Iterator

remove

public boolean remove(java.lang.Object object)
Removes an occurrence of the specified object from this HashSet.

Specified by:
remove in interface Collection
Specified by:
remove in interface Set
Overrides:
remove in class AbstractCollection
Parameters:
object - the object to remove
Returns:
true if this HashSet is modified, false otherwise

size

public int size()
Answers the number of elements in this HashSet.

Specified by:
size in interface Collection
Specified by:
size in interface Set
Specified by:
size in class AbstractCollection
Returns:
the number of elements in this HashSet

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

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