Difference between revisions of "Set Intersector Assignment"
Jump to navigation
Jump to search
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
=Motivation= | =Motivation= | ||
− | Performing the set intersection required by the [[Mutual_Friends_MapReduce_Application|Mutual Friends]] exercise can be a bit tricky. This group warmup will familiarize everyone with the provided | + | Performing the set intersection required by the [[Mutual_Friends_MapReduce_Application|Mutual Friends]] exercise can be a bit tricky. This group warmup will familiarize everyone with the provided [https://www.cse.wustl.edu/~dennis.cosgrove/courses/cse231/fall22/apidocs/edu/wustl/cse231s/util/SetIntersector.html SetIntersector<E>] class. |
− | =Code To | + | =Code To Use= |
==SetIntersector<E>== | ==SetIntersector<E>== | ||
class [https://www.cse.wustl.edu/~dennis.cosgrove/courses/cse231/fall22/apidocs/edu/wustl/cse231s/util/SetIntersector.html SetIntersector<E>] | class [https://www.cse.wustl.edu/~dennis.cosgrove/courses/cse231/fall22/apidocs/edu/wustl/cse231s/util/SetIntersector.html SetIntersector<E>] | ||
Line 10: | Line 10: | ||
=Code To Implement= | =Code To Implement= | ||
+ | {{CodeToImplement|Intersections|intersectionOf|setintersector.group}} | ||
+ | {{Sequential|public static <E> Set<E> intersectionOf(Set<E> first, Set<E>... rest)}} | ||
+ | |||
+ | Note: You do not have to implement the logic of set intersection at all, that is all done by the SetIntersector<>() given to you in the imports. | ||
+ | |||
+ | Note: the "rest" parameter leverages the [https://docs.oracle.com/javase/8/docs/technotes/guides/language/varargs.html varargs] feature. You may treat this parameter as an Set<E>[]. | ||
+ | |||
+ | =Client= | ||
+ | {{CodeToInvestigate|IntersectionClient|main|setintersector.client|main}} | ||
=Testing= | =Testing= | ||
{{TestSuite|_IntersectionTestSuite|setintersector.group}} | {{TestSuite|_IntersectionTestSuite|setintersector.group}} |
Latest revision as of 19:15, 28 February 2023
Motivation
Performing the set intersection required by the Mutual Friends exercise can be a bit tricky. This group warmup will familiarize everyone with the provided SetIntersector<E> class.
Code To Use
SetIntersector<E>
class SetIntersector<E>
Code To Implement
class: | Intersections.java | |
methods: | intersectionOf | |
package: | setintersector.group | |
source folder: | student/src/main/java |
method: public static <E> Set<E> intersectionOf(Set<E> first, Set<E>... rest)
(sequential implementation only)
Note: You do not have to implement the logic of set intersection at all, that is all done by the SetIntersector<>() given to you in the imports.
Note: the "rest" parameter leverages the varargs feature. You may treat this parameter as an Set<E>[].
Client
class: | IntersectionClient.java | DEMO: |
methods: | main | |
package: | setintersector.client | |
source folder: | src/main/java |
Testing
class: | _IntersectionTestSuite.java | |
package: | setintersector.group | |
source folder: | testing/src/test/java |