Homework # 7
In this homework, you will write a generic class hierarchy for sets and maps for Java.
GTUSetInt<T> is a Java interface with the following methods.
| empty | |
| Test whether container is empty | |
| size | |
| Return container size | |
| max_size | |
| Return maximum size | |
| insert | |
| Insert element, throws exception InvalidParameterException if the element is already in the set | |
| intersection | |
The returned set is the intersection of this set and the given set.
| erase | |
| Erase element | |
| clear | |
| Clear all content | |
| find | |
| Get iterator to element | |
| count | |
| Count elements with a specific value | |
| begin | |
| Return iterator to beginning | |
| end | |
| Return iterator to end | |
The class GTUSet<T> implements the GTUSetInt interface. It will keep its data using Java arrays. Do not use any Java Collection classes. It implements the intersection method as follows:
| intersection |
| GTUSetInt<T> intersection(GTUSetInt<T>) |
The returned set is the intersection of this set and the given set.
The class GTUMap<K, V> extends from GTUSet< javafx.util.Pair <K, V> > and implements the following extra method
| at | |
| Access element | |
| V at(K k) If k matches the key of an element in the set, the method returns a reference to its mapped value. | |
The class GTUIterator implements the following methods
Write your driver class to test the all the classes and all of their methods.

![[Solved] CSE 241-Homework 7- a generic class hierarchy for sets and maps for Java](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] CSE 241-Homework 2-continued Connect Four program](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.