Question: Create a public non-final class called Merger. It should provide one public class method called merge. Merge should accept two Lists of sorted Comparable Java

Create a public non-final class called Merger. It should provide one public class method called merge. Merge should accept two Lists of sorted Comparable Java objects and return one merged List of Comparableobjects. If both lists are null you should return null. If either is null you should return the other. If both are empty you should return an empty List. Create a public non-final class called Merger. It should provide one public

Create a public non-final class called Merger. It should provide one public class method called merge. Merge should accept two Lists of sorted Comparable Java objects and return one merged List of Comparable objects. If both lists are null you should return null. If either is null you should return the other. If both are empty you should return an empty List. You will want to review the List documentation for an overview of helpful List operations. You will want to import java.util.List and a List implementation, probably java.util.ArrayList. Note that if you remove items from the list this will change the list's size, so you will need to consider how this impacts your loops. Finally your merge function can alter first and second if needed. We don't expect those lists to be the same after we call merge. As a reminder, first.compareTo(second) returns a positive value if first is larger than second, a negative value if first is smaller than second, and 0 if they are equal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!