public class Range<T extends Comparable<T>> extends Tuple2<T,T>
Tuple2
with two times the same type.Constructor and Description |
---|
Range(T v1,
T v2) |
Range(Tuple2<T,T> tuple) |
Modifier and Type | Method and Description |
---|---|
Optional<Range<T>> |
intersect(T t1,
T t2)
The intersection of two ranges.
|
Optional<Range<T>> |
intersect(Tuple2<T,T> other)
The intersection of two ranges.
|
boolean |
overlaps(T t1,
T t2)
Whether two ranges overlap.
|
boolean |
overlaps(Tuple2<T,T> other)
Whether two ranges overlap.
|
array, clone, compareTo, concat, concat, concat, concat, concat, concat, concat, degree, equals, hashCode, intersect, iterator, list, map, map1, map2, overlaps, swap, toString, v1, v2
finalize, getClass, notify, notifyAll, wait, wait, wait
collectors, collectors, collectors, collectors, collectors, collectors, collectors, collectors, range, tuple, tuple, tuple, tuple, tuple, tuple, tuple, tuple, tuple
forEach, spliterator
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 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 © 2015. All Rights Reserved.