E
- public class THashSet<E> extends TAbstractSet<E> implements TCloneable, TSerializable
Constructor and Description |
---|
THashSet()
Constructs a new empty instance of
HashSet . |
THashSet(int capacity)
Constructs a new instance of
HashSet with the specified capacity. |
THashSet(int capacity,
float loadFactor)
Constructs a new instance of
HashSet with the specified capacity
and load factor. |
THashSet(TCollection<? extends E> collection)
Constructs a new instance of
HashSet containing the unique
elements in the specified collection. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E object)
Adds the specified object to this
HashSet if not already present. |
void |
clear()
Removes all elements from this
HashSet , leaving it empty. |
Object |
clone() |
TObject |
clone0()
Returns a new
HashSet with the same elements and size as this
HashSet . |
boolean |
contains(Object object)
Searches this
HashSet for the specified object. |
boolean |
isEmpty()
Returns true if this
HashSet has no elements, false otherwise. |
TIterator<E> |
iterator()
Returns an Iterator on the elements of this
HashSet . |
boolean |
remove(Object object)
Removes the specified object from this
HashSet . |
int |
size()
Returns the number of elements in this
HashSet . |
equals, hashCode, removeAll
addAll, containsAll, retainAll, toArray, toArray, toString
equals0, finalize, getClass0, notify0, notifyAll0, wait0, wait0, waitImpl
addAll, containsAll, retainAll, spliterator, stream, toArray, toArray
public THashSet()
HashSet
.public THashSet(int capacity)
HashSet
with the specified capacity.capacity
- the initial capacity of this HashSet
.public THashSet(int capacity, float loadFactor)
HashSet
with the specified capacity
and load factor.capacity
- the initial capacity.loadFactor
- the initial load factor.public THashSet(TCollection<? extends E> collection)
HashSet
containing the unique
elements in the specified collection.collection
- the collection of elements to add.public boolean add(E object)
HashSet
if not already present.add
in interface TCollection<E>
add
in class TAbstractCollection<E>
object
- the object to add.true
when this HashSet
did not already contain
the object, false
otherwisepublic void clear()
HashSet
, leaving it empty.clear
in interface TCollection<E>
clear
in class TAbstractCollection<E>
isEmpty()
,
size()
public TObject clone0()
HashSet
with the same elements and size as this
HashSet
.HashSet
.Cloneable
public boolean contains(Object object)
HashSet
for the specified object.contains
in interface TCollection<E>
contains
in class TAbstractCollection<E>
object
- the object to search for.true
if object
is an element of this
HashSet
, false
otherwise.public boolean isEmpty()
HashSet
has no elements, false otherwise.isEmpty
in interface TCollection<E>
isEmpty
in class TAbstractCollection<E>
true
if this HashSet
has no elements,
false
otherwise.size()
public boolean remove(Object object)
HashSet
.remove
in interface TCollection<E>
remove
in class TAbstractCollection<E>
object
- the object to remove.true
if the object was removed, false
otherwise.public int size()
HashSet
.size
in interface TCollection<E>
HashSet
.Copyright © 2019. All rights reserved.