Class NaturalRanking.IntList
- java.lang.Object
-
- org.apache.commons.statistics.ranking.NaturalRanking.IntList
-
- Enclosing class:
- NaturalRanking
private static class NaturalRanking.IntList extends java.lang.Object
An expandable list of int values. This allows tracking array positions without using boxed values in aList<Integer>
.
-
-
Constructor Summary
Constructors Constructor Description IntList(int max)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
add(int value)
Adds the value to the list.(package private) void
clear()
Clear the list.(package private) int
get(int index)
Gets the element at the specifiedindex
.(package private) void
shuffle(java.util.function.IntUnaryOperator randomIntFunction)
Shuffle the list.(package private) int
size()
Gets the number of elements in the list.private static void
swap(int[] array, int i, int j)
Swaps the two specified elements in the specified array.
-
-
-
Method Detail
-
add
void add(int value)
Adds the value to the list.- Parameters:
value
- the value
-
get
int get(int index)
Gets the element at the specifiedindex
.- Parameters:
index
- Element index- Returns:
- the element
-
size
int size()
Gets the number of elements in the list.- Returns:
- the size
-
clear
void clear()
Clear the list.
-
shuffle
void shuffle(java.util.function.IntUnaryOperator randomIntFunction)
Shuffle the list.- Parameters:
randomIntFunction
- Function maps positivex
randomly to[0, x)
.
-
swap
private static void swap(int[] array, int i, int j)
Swaps the two specified elements in the specified array.- Parameters:
array
- Data arrayi
- First indexj
- Second index
-
-