Top Description Fields Constructors Methods
org.jooq.lambda.tuple

public Class Range<T extends Comparable<T>>

extends Tuple2<T extends Comparable<T>, T extends Comparable<T>>
Class Inheritance
Imports
java.util.Optional

A range is a special Tuple2 with two times the same type.

Ranges can be (partially) unbounded if one or both of their bounds are null, which corresponds to "infinity", if T is a type that doesn't already have an infinity value, such as Double#POSITIVE_INFINITY or Double#NEGATIVE_INFINITY.

Ranges are inclusive on both bounds.

Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from org.jooq.lambda.tuple.Tuple2:
v1v2

Constructor Summary

AccessConstructor and Description
public
Range(T lowerInclusive, T upperInclusive)

public
Range(Tuple2<T, T> tuple)

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(T t)

Whether a value is contained in this range.

public boolean
contains(Range<T> other)

Whether a range is contained in this range.

public Optional<Range<T>>
intersect(Tuple2<T, T> other)
Deprecated - Use intersect(Range) instead.

The intersection of two ranges.

public Optional<Range<T>>
intersect(Range<T> other)

The intersection of two ranges.

public Optional<Range<T>>
intersect(T lowerInclusive, T upperInclusive)

The intersection of two ranges.

public boolean
overlaps(Tuple2<T, T> other)
Deprecated - Use overlaps(Range) instead.

Whether two ranges overlap.

public boolean
overlaps(Range<T> other)

Whether two ranges overlap.

public boolean
overlaps(T lowerInclusive, T upperInclusive)

Whether two ranges overlap.

private static <T extends Comparable<T>> Tuple2<T, T>
r(T t1, T t2)

Inherited from org.jooq.lambda.tuple.Tuple2:
arrayclonecompareToconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatdegreeequalshashCodeintersectiteratorlimit0limit1limit2listmapmap1map2overlapsskip0skip1skip2split0split1split2swaptoArraytoListtoMaptoMaptoMaptoMaptoSeqtoStringv1v2

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.jooq.lambda.tuple.Tuple2.serialVersionUID.

Constructor Detail

Rangeback to summary
public Range(T lowerInclusive, T upperInclusive)
Rangeback to summary
public Range(Tuple2<T, T> tuple)

Method Detail

containsback to summary
public boolean contains(T t)

Whether a value is contained in this range.


// true
range(1, 3).contains(2)

// false
range(1, 3).contains(4)
containsback to summary
public boolean contains(Range<T> other)

Whether a range is contained in this range.


// true
range(1, 3).contains(range(2, 3))

// false
range(1, 3).contains(range(2, 4))
intersectback to summary
public Optional<Range<T>> intersect(Tuple2<T, T> other)

Deprecated

- Use intersect(Range) instead.

The intersection of two ranges.


// (2, 3)
range(1, 3).intersect(range(2, 4))

// none
range(1, 3).intersect(range(5, 8))
intersectback to summary
public Optional<Range<T>> intersect(Range<T> other)

The intersection of two ranges.


// (2, 3)
range(1, 3).intersect(range(2, 4))

// none
range(1, 3).intersect(range(5, 8))
intersectback to summary
public Optional<Range<T>> intersect(T lowerInclusive, T upperInclusive)

The intersection of two ranges.


// (2, 3)
range(1, 3).intersect(2, 4)

// none
range(1, 3).intersect(5, 8)
overlapsback to summary
public boolean overlaps(Tuple2<T, T> other)

Deprecated

- Use overlaps(Range) instead.

Whether two ranges overlap.


// true
range(1, 3).overlaps(range(2, 4))

// false
range(1, 3).overlaps(range(5, 8))
Annotations
@Deprecated
overlapsback to summary
public boolean overlaps(Range<T> other)

Whether two ranges overlap.


// true
range(1, 3).overlaps(range(2, 4))

// false
range(1, 3).overlaps(range(5, 8))
overlapsback to summary
public boolean overlaps(T lowerInclusive, T upperInclusive)

Whether two ranges overlap.


// true
range(1, 3).overlaps(2, 4)

// false
range(1, 3).overlaps(5, 8)
rback to summary
private static <T extends Comparable<T>> Tuple2<T, T> r(T t1, T t2)