Constructor and Description |
---|
IntSet()
Default constructor.
|
IntSet(int capacity)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(int key)
Stores the specified key if it has not been stored before.
|
boolean |
contains(int key)
Checks if the set contains the specified key.
|
protected int |
hash(int id)
Returns the hash value of the element with the specified id.
|
int |
key(int id)
Returns the key with the specified id.
|
protected void |
rehash(int newSize)
Rehashes all entries.
|
int[] |
toArray()
Returns an array with all elements.
|
public IntSet()
public IntSet(int capacity)
capacity
- initial array capacitypublic final boolean add(int key)
key
- key to be addedtrue
if the key did not exist yet and was storedpublic final boolean contains(int key)
key
- key to be looked uppublic final int key(int id)
1
instead of 0
.id
- id of the key to returnprotected int hash(int id)
ASet
protected void rehash(int newSize)
ASet
public final int[] toArray()
Copyright © 2005–2015 BaseX Team. All rights reserved.