Answered step by step
Verified Expert Solution
Question
1 Approved Answer
* Creates a new set that combines the contents of this set and * a second given set without affecting the original two sets. *
* Creates a new set that combines the contents of this set and * a second given set without affecting the original two sets. * * @param otherSet the given set * @return a setOfEntries that is the union of the two sets */ public ArraySetWithArrayunion(ArraySetWithArray otherSet) { // TODO Project 2 return null; // THIS IS A STUB } // end union /** * Creates a new set that contains those objects that occur in both this * set and otherSet without affecting the original two sets. * * @param otherSet the given set * @return a set that is the intersection of the two sets */ public ArraySetWithArray intersection(ArraySetWithArray otherSet) { // TODO Project 2 // one return statement per method please // do NOT call contains, utilize getIndexOf(anEntry) instead return null; // THIS IS A STUB } // end intersection /** * Creates a new set of objects that would be left in this set * after removing those that also occur in a second given set * without affecting the original two sets. * * @param otherSet the given set * @return a set that is the difference of the two sets */ public ArraySetWithArray difference(ArraySetWithArray otherSet) { // TODO Project 2 // one return statement per method please // do NOT call contains, removeEntry(givenIndex) methods instead return null; // THIS IS A STUB } // end difference /** * Creates a new set of objects that are in this set and are less than a given object. * * @param anEntry a given object * @return a new set of objects that are in this set and are less than anObject */ public ArraySetWithArray getAllLessThan(T anEntry) { // TODO Project 2 // one return statement per method please // for (int i = 0; i < a.length; i++) { // utilize compareTo method return null; // THIS IS A STUB } // end getAllLessThan /** * Checks if all the elements of the given set are also included in the other set * * @param otherSet set to check * @return returns true if all the elements of the given set are also included in the other set */ public boolean isSubset(ArraySetWithArray otherSet) { // TODO Project 2 // one return statement per method please // utilize difference method return false; // THIS IS A STUB } /** * Move the first element to be the last in the set by rotating the elements */ public void moveFirstToEnd() { // TODO Project2 }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started