# Class NumberRange<N extends Number>

java.lang.Object
org.apache.commons.lang3.Range<N>
org.apache.commons.lang3.NumberRange<N>

Type Parameters:
  `N` - The Number class.

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `DoubleRange, IntegerRange, LongRange`

public class NumberRange<N extends Number> extends Range<N>
Specializes `Range` for `Number`s.

We only offer specializations for Integer, Long, and Double (like Java Streams).

Since:
  3.13.0
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NumberRange(N number1, N number2, Comparator<N> comp)`
  Creates an instance.

- ## Method Summary

  ### Methods inherited from class Range

  `between, between, contains, containsRange, elementCompareTo, equals, fit, getComparator, getMaximum, getMinimum, hashCode, intersectionWith, is, is, isAfter, isAfterRange, isBefore, isBeforeRange, isEndedBy, isNaturalOrdering, isOverlappedBy, isStartedBy, of, of, toString, toString`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NumberRange

    public NumberRange(N number1, N number2, Comparator<N> comp)
    Creates an instance.
    Parameters:
      `number1` - the first element, not null
      `number2` - the second element, not null
      `comp` - the comparator to be used, null for natural ordering
    Throws:
      `NullPointerException` - when element1 is null.
      `NullPointerException` - when element2 is null.