Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

The union of two collections consists of their contents combined into a new collection.

The union of two collections consists of their contents combined into a new collection. Add a method union to the interface BagInterface for the ADT bag that returns as a new bag the union of the bag receiving the call to the method and the bag that is the method's one argument. Note that the union of two bags might contain duplicate items. For example, if object x occures five times in one bag and twice in another, the union of these bags contains x seven times. Specifically, suppose bag1 and bag2 are Bag objects, where Bag implements BagInterface; bag1 contains the String objects a, b,c; and bag2 contains the String objects b,b,d and e. After the statementBagInterface<String> everything = bag1.union(bag2);executes the bag and everything contains the strings a, b, b, b, c, d, and e.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question