Learn how to take a Java collection of intervals and merge the overlapping ones.
Also find me here:
Baeldung Author
Sam Gardner
I'm a UK based full stack developer with 8+ years of experience. I specialise in Java but enjoy working with frontend languages and libraries as well. I'm always keen to learn new things and pass on that knowledge to others.
Here's what I've written (so far):
Baeldung on Java
- All
- Java Collections (4)
- Testing (2)
- Java String (2)
- Java Concurrency (2)
- Jackson (2)
- Reactive (1)
- Networking (1)
- Java Web (1)
- Java Streams (1)
- Java Numbers (1)
- Java Dates (1)
- Java (1)
- JSON (1)
- Algorithms (1)
Simple Web Server in Java 18
Filed under Java Web
Learn about Simple Web Server in Java 18 and how it works.
Calculate Number of Weekdays Between Two Dates in Java
Filed under Java Dates
Learn two different methods in Java for calculating the number of weekdays between two dates.
Verify That Lambda Expression Was Called Using Mockito
Filed under Testing
Learn how to test if our code calls a lambda function by using Mockito.
Compare StringBuilder Objects in Java
Filed under Java String
Learn how to compare two StringBuilder objects in Java releases before and after Java 11.
Truncate a Double to Two Decimal Places in Java
Filed under Java Numbers
Learn to truncate a double to two decimal places in Java.
Check if Letter Is Emoji With Java
Filed under Java String
Discover multiple Java methods for detecting emojis in a string.
Mock Same Method with Different Parameters
Filed under Testing
Learn how to mock a method in Java to receive different responses based on the parameters passed in.
How to Check if a Value Exists in a JSON Array for a Particular Key
Filed under JSON
Learn how to inspect a JSON array and check if it contains a particular key-value pair.
How to Get First Item From a Java Set
Filed under Java Collections
Learn how to get the first item from a Java Set.
Difference Between Future, CompletableFuture, and Rxjava’s Observable
Filed under Java Concurrency, Reactive
Discover the difference between Future, CompletableFuture, and Rxjava’s Observable.
How to Get Notified When a Task Completes in Java Executors
Filed under Java Concurrency
Learn several options for receiving notifications on the completion of a task depending on how you’re running it.
Setting Default Values to Null Fields in Jackson Mapping
Filed under Jackson
Explore three ways of dealing with missing or null values in JSON when parsing it with Jackson.
@JsonMerge Annotation in Jackson
Filed under Jackson
Discover how to use the @JsonMerge annotation from the Jackson Java library.
Check if a List Contains an Element From Another List in Java
Filed under Java Collections
Learn how to check if a list contains elements from another list in Java.
URL Query Manipulation in Java
Filed under Java, Networking
A quick and practical guide to URL manipulation in Java.
Moving Items Around in an Arraylist
Filed under Java Collections
Learn three different ways of moving items around in an ArrayList.
Mapping an Array of Integers to Strings Using Java Streams
Filed under Java Streams
Learn how to use Java Streams to convert arrays of Integers or primitive integers into strings.