|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javatools.datatypes.IntSet
public class IntSet
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools).
It is licensed under the Creative Commons Attribution License
(see http://creativecommons.org/licenses/by/3.0) by
the YAGO-NAGA team (see http://mpii.de/yago-naga).
This class implements a space-efficient integer set. All operations are linear time, though...
Constructor Summary | |
---|---|
IntSet()
Creates a new IntSet |
|
IntSet(java.util.BitSet copy)
Creates a new IntSet by copying the given bit set |
|
IntSet(int capacity)
Creates a new IntSet with an initial capacity |
|
IntSet(IntSet copy)
Creates a new IntSet by copying the given set |
Method Summary | ||
---|---|---|
boolean |
add(int v)
Adds the element |
|
boolean |
add(java.lang.Integer e)
Adds the element |
|
boolean |
add(long i)
Adds this element |
|
boolean |
add(java.lang.Number e)
Adds this element |
|
boolean |
addAll(java.util.BitSet s)
Adds all elements |
|
boolean |
addAll(java.util.Collection<? extends java.lang.Integer> c)
Adds all elements |
|
boolean |
addAll(IntSet s)
Adds all elements |
|
void |
addTo(java.util.BitSet s)
Adds all elements of this set to s |
|
void |
clear()
Removes all elements |
|
void |
clear(int capacity)
|
|
boolean |
contains(int i)
TRUE if the set contains i |
|
boolean |
contains(long i)
TRUE if the set contains i |
|
boolean |
contains(java.lang.Object o)
TRUE if the set contains o |
|
boolean |
containsAll(java.util.Collection<?> c)
TRUE if the set contains all elements of c |
|
IntSet |
enhancedBy(int addMe)
Adds addMe, returns THIS |
|
IntSet |
enhancedBy(IntSet addMe)
Adds all elements, returns THIS |
|
boolean |
isEmpty()
TRUE if the set is empty |
|
PeekIterator<java.lang.Integer> |
iterator()
|
|
static void |
main(java.lang.String[] args)
Test method |
|
static IntSet |
of(int... initial)
Creates a new IntSet from initial values. |
|
int |
poll()
|
|
boolean |
remove(int i)
Removes one element, returns TRUE if the set was modified |
|
boolean |
remove(long i)
Removes one element, returns TRUE if the set was modified |
|
boolean |
remove(java.lang.Object o)
Removes one element (has to be a number), returns TRUE if the set was modified |
|
boolean |
removeAll(java.util.BitSet s)
Removes all elements of s from this set |
|
boolean |
removeAll(java.util.Collection<?> c)
Removes all elements in c |
|
boolean |
removeAll(IntSet c)
Removes all elements in c |
|
boolean |
retainAll(java.util.Collection<?> c)
Removes all elements that are not in c |
|
void |
setTo(IntSet copy)
Overwrites the current IntSet with the given one |
|
IntSet |
shrunkBy(int addMe)
Removes the given element, returns THIS |
|
IntSet |
shrunkBy(IntSet addMe)
Removes the given elements, returns THIS |
|
int |
size()
|
|
java.lang.Object[] |
toArray()
Returns an array of the elements of this set |
|
|
toArray(T[] a)
Not supported |
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
equals, hashCode |
Constructor Detail |
---|
public IntSet(IntSet copy)
public IntSet(java.util.BitSet copy)
public IntSet()
public IntSet(int capacity)
Method Detail |
---|
public PeekIterator<java.lang.Integer> iterator()
iterator
in interface java.lang.Iterable<java.lang.Integer>
iterator
in interface java.util.Collection<java.lang.Integer>
iterator
in interface java.util.Set<java.lang.Integer>
public boolean add(int v)
public void clear(int capacity)
public int poll()
public static IntSet of(int... initial)
public void setTo(IntSet copy)
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<java.lang.Integer>
retainAll
in interface java.util.Set<java.lang.Integer>
public boolean remove(int i)
public boolean remove(long i)
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<java.lang.Integer>
remove
in interface java.util.Set<java.lang.Integer>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<java.lang.Integer>
removeAll
in interface java.util.Set<java.lang.Integer>
public boolean removeAll(IntSet c)
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<java.lang.Integer>
toArray
in interface java.util.Set<java.lang.Integer>
public <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<java.lang.Integer>
toArray
in interface java.util.Set<java.lang.Integer>
public java.lang.String toString()
toString
in class java.lang.Object
public int size()
size
in interface java.util.Collection<java.lang.Integer>
size
in interface java.util.Set<java.lang.Integer>
public boolean add(long i)
public boolean add(java.lang.Number e)
public boolean addAll(java.util.Collection<? extends java.lang.Integer> c)
addAll
in interface java.util.Collection<java.lang.Integer>
addAll
in interface java.util.Set<java.lang.Integer>
public boolean addAll(IntSet s)
public boolean addAll(java.util.BitSet s)
public boolean removeAll(java.util.BitSet s)
public void addTo(java.util.BitSet s)
public IntSet enhancedBy(IntSet addMe)
public IntSet enhancedBy(int addMe)
public IntSet shrunkBy(IntSet addMe)
public IntSet shrunkBy(int addMe)
public boolean contains(int i)
public boolean contains(long i)
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<java.lang.Integer>
contains
in interface java.util.Set<java.lang.Integer>
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<java.lang.Integer>
containsAll
in interface java.util.Set<java.lang.Integer>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<java.lang.Integer>
isEmpty
in interface java.util.Set<java.lang.Integer>
public void clear()
clear
in interface java.util.Collection<java.lang.Integer>
clear
in interface java.util.Set<java.lang.Integer>
public boolean add(java.lang.Integer e)
add
in interface java.util.Collection<java.lang.Integer>
add
in interface java.util.Set<java.lang.Integer>
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |