Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Unordered List can be used to implement a discrete set. Create a new JAVA class called ListSetOperator, which will be used to perform set

The Unordered List can be used to implement a discrete set. Create a new JAVA class called "ListSetOperator", which will be used to perform set operations with UList objects.

1) The class should include methods:

public UList union(UList Set 1, UList Set2) that returns a reference to a new list containing all of the items from Set1 or Set2 with no repeats,

public UList intersect(UList Set1, UList Set2) that returns a reference to a new list containing only the items from both Set1 and also Set2 with no repeats, and

public UList subtract(UList Set 1, UList Set2) that returns a reference to a new list containing all of the items that are in Set1 but not Set2

2) Write a ListSetMain class to demonstrate that your methods work. Include code that displays the IDs of all of the elements in the resulting sets (in any order). Use "A', "B", "C",... as elements.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions