Skip to content
Open
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
3 changes: 3 additions & 0 deletions src/main/scala/stdlib/Sets.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ object Sets extends FlatSpec with Matchers with org.scalaexercises.definitions.S
}

/** Set elements can be removed with a tuple:
* (note -- unary '-' on a tuple with more than one value is deprecated from scala 2.13.0)
*/
def tupleRemovingSets(res0: Boolean, res1: Boolean, res2: Int) {
val mySet = Set("Michigan", "Ohio", "Wisconsin", "Iowa")
val aNewSet = mySet - ("Michigan", "Ohio") // Notice: single '-' operator for tuples
// the above operation will work, but result in a warning:
// warning: method - in trait SetOps is deprecated (since 2.13.0): Use &- with an explicit collection argument instead of - with varargs

aNewSet.contains("Michigan") should be(res0)
aNewSet.contains("Wisconsin") should be(res1)
Expand Down