Class Range

java.lang.Object
io.quarkus.panache.common.Range

public class Range extends Object

Utility class to represent ranging information. Range instances are immutable.

Usage:

 Range range = Range.of(0, 5);
 
Note that due to the end index being inclusive, it's impossible to write empty ranges.
  • Constructor Details

    • Range

      public Range(int startIndex, int lastIndex)
      Creates a new range
      Parameters:
      startIndex - the start index to include, 0-based
      lastIndex - the end index to include, 0-based
  • Method Details

    • of

      public static Range of(int startIndex, int lastIndex)
      Creates a new range
      Parameters:
      startIndex - the start index to include, 0-based
      lastIndex - the end index to include, 0-based
    • getStartIndex

      public int getStartIndex()
      Returns:
      the start index to include, 0-based
    • getLastIndex

      public int getLastIndex()
      Returns:
      the last index to include, 0-based