Class SortIndex<T>
java.lang.Object
org.jacoco.report.internal.html.table.SortIndex<T>
- Type Parameters:
T- type of the items
A index on a list of items sorted with a given
Comparator. The index
does not change the list itself.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSortIndex(Comparator<? super T> comparator) Creates a new index based in the given comparator. -
Method Summary
Modifier and TypeMethodDescriptionintgetPosition(int idx) Returns the sorted position of the element with the given index in the items list provided to the init() method.voidInitializes the index for the given list of items.
-
Field Details
-
comparator
-
list
-
positions
private int[] positions
-
-
Constructor Details
-
SortIndex
Creates a new index based in the given comparator.- Parameters:
comparator- comparator to sort items
-
-
Method Details
-
init
-
getPosition
public int getPosition(int idx) Returns the sorted position of the element with the given index in the items list provided to the init() method.- Parameters:
idx- index of a element of the list- Returns:
- its position in a sorted list
-