Package org.apache.commons.lang3
Class LongRange
- java.lang.Object
-
- org.apache.commons.lang3.Range<N>
-
- org.apache.commons.lang3.NumberRange<java.lang.Long>
-
- org.apache.commons.lang3.LongRange
-
- All Implemented Interfaces:
java.io.Serializable
public final class LongRange extends NumberRange<java.lang.Long>
SpecializesNumberRange
forLong
s.This class is not designed to interoperate with other NumberRanges
- Since:
- 3.13.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description private
LongRange(java.lang.Long number1, java.lang.Long number2)
Creates an instance.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LongRange
of(long fromInclusive, long toInclusive)
Creates a range with the specified minimum and maximum values (both inclusive).static LongRange
of(java.lang.Long fromInclusive, java.lang.Long toInclusive)
Creates a range with the specified minimum and maximum values (both inclusive).-
Methods inherited from class org.apache.commons.lang3.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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LongRange
private LongRange(java.lang.Long number1, java.lang.Long number2)
Creates an instance.- Parameters:
number1
- the first element, not nullnumber2
- the second element, not null- Throws:
java.lang.NullPointerException
- when element1 is null.java.lang.NullPointerException
- when element2 is null.
-
-
Method Detail
-
of
public static LongRange of(long fromInclusive, long toInclusive)
Creates a range with the specified minimum and maximum values (both inclusive).The range uses the natural ordering of the elements to determine where values lie in the range.
The arguments may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will return the correct values.
- Parameters:
fromInclusive
- the first value that defines the edge of the range, inclusive.toInclusive
- the second value that defines the edge of the range, inclusive.- Returns:
- the range object, not null.
-
of
public static LongRange of(java.lang.Long fromInclusive, java.lang.Long toInclusive)
Creates a range with the specified minimum and maximum values (both inclusive).The range uses the natural ordering of the elements to determine where values lie in the range.
The arguments may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will return the correct values.
- Parameters:
fromInclusive
- the first value that defines the edge of the range, inclusive.toInclusive
- the second value that defines the edge of the range, inclusive.- Returns:
- the range object, not null.
- Throws:
java.lang.IllegalArgumentException
- if either element is null.
-
-