java.io.Serializable
, java.lang.Cloneable
, java.lang.Comparable<Tuple2<T,T>>
, java.lang.Iterable<java.lang.Object>
, Tuple
public class Range<T extends java.lang.Comparable<T>> extends Tuple2<T,T>
Tuple2
with two times the same type.Constructor | Description |
---|---|
Range(Tuple2<T,T> tuple) |
|
Range(T v1,
T v2) |
Modifier and Type | Method | Description |
---|---|---|
java.util.Optional<Range<T>> |
intersect(Tuple2<T,T> other) |
The intersection of two ranges.
|
java.util.Optional<Range<T>> |
intersect(T t1,
T t2) |
The intersection of two ranges.
|
boolean |
overlaps(Tuple2<T,T> other) |
Whether two ranges overlap.
|
boolean |
overlaps(T t1,
T t2) |
Whether two ranges overlap.
|
finalize, getClass, notify, notifyAll, wait, wait, wait
array, clone, compareTo, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, degree, equals, hashCode, intersect, iterator, limit0, limit1, limit2, list, map, map1, map2, overlaps, skip0, skip1, skip2, split0, split1, split2, swap, toArray, toList, toMap, toMap, toMap, toMap, toSeq, toString, v1, v2
public boolean overlaps(Tuple2<T,T> other)
// true
range(1, 3).overlaps(range(2, 4))
// false
range(1, 3).overlaps(range(5, 8))
public boolean overlaps(T t1, T t2)
// true
range(1, 3).overlaps(2, 4)
// false
range(1, 3).overlaps(5, 8)
public java.util.Optional<Range<T>> intersect(Tuple2<T,T> other)
// (2, 3)
range(1, 3).intersect(range(2, 4))
// none
range(1, 3).intersect(range(5, 8))
Copyright © 2018. All rights reserved.