Constructor and Description |
---|
Set_Swap(int offSet)
Creates an empty bipartite set having numbers greater or equal than
offSet (possibly < 0) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(int element)
Add element to the set
|
protected void |
addSize(int delta) |
void |
clear()
Remove all elements from the set
|
boolean |
contains(int element)
Test the existence of element in the set
|
SetType |
getSetType() |
ISetIterator |
iterator()
Use the following loop to iterate over this set without autoboxing.
|
int |
max() |
int |
min() |
ISetIterator |
newIterator()
Creates a new iterator object, for nested loops only.
|
boolean |
remove(int element)
Remove the first occurrence of element from the set
|
protected void |
setSize(int s) |
int |
size() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isEmpty, toArray
forEach, spliterator
public Set_Swap(int offSet)
offSet
(possibly < 0)offSet
- smallest allowed value in this set (possibly < 0)public boolean add(int element)
ISet
public boolean remove(int element)
ISet
public boolean contains(int element)
ISet
public int size()
protected void setSize(int s)
protected void addSize(int delta)
public void clear()
ISet
public int min()
public int max()
public SetType getSetType()
getSetType
in interface ISet
public ISetIterator iterator()
ISet
// more readable but with autoboxing
for(int value:set){
...
}
// more verbose but without autoboxing
ISetIterator iter = set.primitiveIterator();
while(iter.hasNext()){
int k = iter.next();
...
}
Do not use this iterator to make nested loops over ISet
(prefer ISet.newIterator()
)public ISetIterator newIterator()
ISet
newIterator
in interface ISet
Copyright © 2018. All rights reserved.