Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/scala/stdlib/Sets.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ object Sets extends FlatSpec with Matchers with org.scalaexercises.definitions.S
aNewSet.size should be(res2)
}

/** Set elements can be removed with a tuple:
/** Multiple elements can be removed from a Set using the overloaded - method:
*/
def tupleRemovingSets(res0: Boolean, res1: Boolean, res2: Int) {
def multiRemovingSets(res0: Boolean, res1: Boolean, res2: Int) {
val mySet = Set("Michigan", "Ohio", "Wisconsin", "Iowa")
val aNewSet = mySet - ("Michigan", "Ohio") // Notice: single '-' operator for tuples
val aNewSet = mySet - ("Michigan", "Ohio") // Notice: single '-' operator can remove multiple elements, as many as you want because the method is varadiac

aNewSet.contains("Michigan") should be(res0)
aNewSet.contains("Wisconsin") should be(res1)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/stdlib/SetsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ class SetsSpec extends Spec with Checkers {
)
}

def `we can remove multiple members with tuples` = {
def `we can remove multiple members with the overloaded - method` = {
check(
Test.testSuccess(
Sets.tupleRemovingSets _,
Sets.multiRemovingSets _,
false :: true :: 2 :: HNil
)
)
Expand Down