public interface ISet extends Iterable<Integer>
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() |
default boolean |
isEmpty() |
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() |
default int[] |
toArray()
Copies the set in an array if integers
|
forEach, spliterator
ISetIterator iterator()
// 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 newIterator()
)ISetIterator newIterator()
boolean add(int element)
element
- element to addboolean remove(int element)
element
- element to addboolean contains(int element)
element
- element to adddefault boolean isEmpty()
int size()
void clear()
int min()
int max()
SetType getSetType()
default int[] toArray()
Copyright © 2018. All rights reserved.