| Modifier and Type | Field and Description |
|---|---|
protected ISetIterator |
iter |
protected int |
size |
protected int[] |
values |
| Constructor and Description |
|---|
Set_FixedArray(int[] vls)
Creates an empty array of integers
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int element)
Add element to the set
|
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
|
int |
size() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisEmpty, toArrayforEach, spliteratorprotected final int size
protected final int[] values
protected ISetIterator iter
public Set_FixedArray(int[] vls)
public boolean add(int element)
ISetpublic boolean remove(int element)
ISetpublic boolean contains(int element)
ISetpublic int size()
public void clear()
ISetpublic SetType getSetType()
getSetType in interface ISetpublic int min()
public int max()
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()
ISetnewIterator in interface ISetCopyright © 2018. All rights reserved.