Question: 2. Consider a member method for the Set ADT used to compare two sets and determine whether they are equal (i.e. they have the same

 2. Consider a member method for the Set ADT used to
compare two sets and determine whether they are equal (i.e. they have
the same elements). Add this method to the Set interface, then implement
it in the StaticBag and DynamicBag classes using the following prototype: public

2. Consider a member method for the Set ADT used to compare two sets and determine whether they are equal (i.e. they have the same elements). Add this method to the Set interface, then implement it in the StaticBag and DynamicBag classes using the following prototype: public boolean equals(Set S2) 3 public interface Set extends Iterable 1 ov 01 > public boolean add(E obj); public boolean isMember(E obj); public boolean remove(E obj); public boolean isEmpty(); public int size(); public void clear(); public Set union(Set S2); public Set difference(Set 32); public Set intersection(Set 52); public boolean isSubSet(Set S2): public boolean equals(Set $2); public Set> singletonsets (: 16 17 ) @Override public boolean equals(Set 2) return false; import java.util.Iterator;0 public class StaticSet implements Set { // current number of elements in set, private int currentSize; w 100 // array of elements private E elements[]; private static final int DEFAULT_SET_SIZE = 10; WNEO00 public staticSet(int maxCapacity) { if (maxCapacity implements Iterator { private int current Position; public SetIterator() this.currentPosition = 0; 6 CO O

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!