question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add Range.overlaps(Range) method

See original GitHub issue

Seems 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:open
  • Created 8 years ago
  • Reactions:12
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ayushsanganicommented, Oct 18, 2021

Is there any plan to implement overlap method on Range?

1reaction
jwgmeligmeylingcommented, Mar 15, 2019

Would be very useful! We’re using isConnected(other) && !intersection(other).isEmpty() too (for Range<LocalDateTime>)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found