Set Intersector Assignment

From CSE231 Wiki
Jump to navigation Jump to search

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>

accept(friendIds)
currentIntersection()

Code To Implement

class: Intersections.java Java.png
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.svg (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: Java.png
methods: main
package: setintersector.client
source folder: src/main/java

Testing

class: _IntersectionTestSuite.java Junit.png
package: setintersector.group
source folder: testing/src/test/java