Package ucar.nc2.util.cache
Class SmartArrayInt
- java.lang.Object
-
- ucar.nc2.util.cache.SmartArrayInt
-
@Immutable public class SmartArrayInt extends Object
integer array in which we want to quickly find the index for a given value. optimize for the case of 1) constant, 2) sequential, 3) sorted- Since:
- 11/4/2014
-
-
Constructor Summary
Constructors Constructor Description SmartArrayInt(int[] raw)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
findIdx(int want)
Find which index holds the value wantint
get(int idx)
int
getN()
void
show(Formatter f)
-
-
-
Method Detail
-
get
public int get(int idx)
-
getN
public int getN()
-
show
public void show(Formatter f)
-
findIdx
public int findIdx(int want)
Find which index holds the value want- Parameters:
want
- value wanted- Returns:
- < 0 if not found, else the index. If duplicates, then return any match
-
-