Class SortIndex<T>

java.lang.Object
org.jacoco.report.internal.html.table.SortIndex<T>
Type Parameters:
T - type of the items

final class SortIndex<T> extends Object
A index on a list of items sorted with a given Comparator. The index does not change the list itself.
  • Field Details

  • Constructor Details

    • SortIndex

      public SortIndex(Comparator<? super T> comparator)
      Creates a new index based in the given comparator.
      Parameters:
      comparator - comparator to sort items
  • Method Details

    • init

      public void init(List<? extends T> items)
      Initializes the index for the given list of items.
      Parameters:
      items - list of items
    • 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