public class SortedIntSet extends Object
Constructor and Description |
---|
SortedIntSet()
Default constructor.
|
SortedIntSet(int[] array) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(int ele)
Add element to set.
|
boolean |
contains(int ele) |
int |
find(int ele)
Find position of
ele in set. |
int |
get(int pos)
Get element at position.
|
int[] |
getArray() |
boolean |
remove(int ele)
Remove element from set.
|
void |
removeAll() |
int |
size()
Number of elements in set.
|
int[] |
toArray() |
void |
union(SortedIntSet set) |
public SortedIntSet()
public SortedIntSet(int[] array)
public int find(int ele)
ele
in set.ele
- The element we're looking for.IntArrayUtils.binarySearch()
.public boolean contains(int ele)
ele
- -true
iff ele
is contained in
the set.public boolean add(int ele)
ele
- -true
iff ele
was not already contained in the set.public boolean remove(int ele)
ele
- -true
iff ele
was actually contained in the set.public int size()
public int get(int pos)
pos
- Get element at this position.public void union(SortedIntSet set)
public void removeAll()
public int[] toArray()
public int[] getArray()
Copyright © 2006–2018 The Apache Software Foundation. All rights reserved.