public class IntSet
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.Integer,java.lang.Integer> |
index
Map of values to index.
|
int |
max
The maximum of values.
|
int |
min
The minimum of values.
|
int[] |
values
Map of index to original values.
|
| Constructor and Description |
|---|
IntSet(int[] values)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
indexOf(int x)
Maps the value to index.
|
static IntSet |
of(int k)
Returns an IntSet of [0, k).
|
static IntSet |
of(int[] y)
Finds the unique values from samples.
|
int |
size()
Returns the number of values.
|
int |
valueOf(int index)
Maps an index to the corresponding value.
|
public final int[] values
protected final java.util.Map<java.lang.Integer,java.lang.Integer> index
public final int min
public final int max
public IntSet(int[] values)
values - the unique values.public int size()
public int valueOf(int index)
index - the index.public int indexOf(int x)
public static IntSet of(int k)
k - the number of unique values.public static IntSet of(int[] y)