add Range.overlaps(Range) method
See original GitHub issueSeems very strange that the Range class doesn’t have an overlaps(Range) or intersects(Range) method.
I expect it would essentially be
public boolean overlaps(Range other) {
return isConnected(other) && !intersection(other).isEmpty();
}
Issue Analytics
- State:
- Created 8 years ago
- Reactions:12
- Comments:7 (2 by maintainers)
Top Results From Across the Web
What is Range.isOverlappedBy in Java? - Educative.io
This method returns true if the specified range passed as a parameter overlaps the range on which this method is applied. Otherwise, it...
Read more >Finding overlapping Range from Range List - java
1 Answer 1 · If that range doesn't already exist in rangeMap , add that range and the corresponding number that says how...
Read more >Finding All Overlapping Intervals - Baeldung
Firstly, we iterate over all possible ranges. For each range, we iterate over all other ranges to check whether both of them overlap...
Read more >overlaps? (Range) - APIdock
Just for completeness (it should behave like this), comparing ranges that start and end with the same value will overlap, e.g. (1..5).overlaps?
Read more >Check if any K ranges overlap at any point - GeeksforGeeks
Approach : The idea is to make a vector of pairs and store the starting point for every range as pair in this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any plan to implement
overlap
method on Range?Would be very useful! We’re using
isConnected(other) && !intersection(other).isEmpty()
too (forRange<LocalDateTime>
)