Record Class Range

java.lang.Object
java.lang.Record
io.kroxylicious.proxy.config.Range

public record Range(int startInclusive, int endExclusive) extends Record
Represents the set of integers between two integer endpoints. So the Range with startInclusive 1 and endExclusive 3 contains the integers 1 and 2. A Range must be non-empty, endExclusive must be greater than startInclusive
  • Constructor Summary

    Constructors
    Constructor
    Description
    Range(int startInclusive, int endExclusive)
    Constructs a Range
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the endExclusive record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Return true if this range does not overlap with other range.
    int
    Returns the value of the startInclusive record component.
    Returns a string representation of this record class.
    Provides a Stream of values contained in the range

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Range

      public Range(int startInclusive, int endExclusive)
      Constructs a Range
      Parameters:
      startInclusive - the (inclusive) initial value
      endExclusive - the exclusive upper bound
      Throws:
      IllegalArgumentException - if end is before start
  • Method Details

    • values

      public IntStream values()
      Provides a Stream of values contained in the range
      Returns:
      stream of values
    • isDistinctFrom

      public boolean isDistinctFrom(Range range)
      Return true if this range does not overlap with other range. If either range ends before the other starts then they must not overlap.
      Parameters:
      range - range to compare
      Returns:
      true if this range does not overlap with other range
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • startInclusive

      public int startInclusive()
      Returns the value of the startInclusive record component.
      Returns:
      the value of the startInclusive record component
    • endExclusive

      public int endExclusive()
      Returns the value of the endExclusive record component.
      Returns:
      the value of the endExclusive record component