|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.util.BitEncodedIntegerSet
@NotThreadSafe public class BitEncodedIntegerSet
A Set that encodes integers as bits in a long. Does not implement java.util.Set since autoboxing is unnecessarily expensive for the ints stored, but follows very similar semantics to Set: no nulls, no duplicates, and order not guaranteed, and adds one more: this can only store ints from 0 to 63, inclusive.
Integers in this set are packed into a single long, setting bit values accordingly and hence the strict range on allowable integers. The upshot is a guaranteed limit on how much memory is consumed, as well as very efficient operations on the set.
Constructor Summary | |
---|---|
BitEncodedIntegerSet()
|
Method Summary | |
---|---|
void |
add(int i)
Adds an integer to the set. |
void |
addAll(BitEncodedIntegerSet otherSet)
Adds all elements of another BitEncodedIntegerSet to the current set. |
void |
clear()
Clears the set |
boolean |
contains(int i)
Tests whether the set contains an integer |
boolean |
equals(Object o)
|
int |
hashCode()
|
boolean |
isEmpty()
Tests if the set is empty |
void |
remove(int i)
Removes an integer from the set |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BitEncodedIntegerSet()
Method Detail |
---|
public void add(int i)
i
- integer to addpublic void remove(int i)
i
- integer to removepublic boolean contains(int i)
i
- integer to check for
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public void clear()
public boolean isEmpty()
public String toString()
toString
in class Object
public void addAll(BitEncodedIntegerSet otherSet)
otherSet
- other set to add
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |