scala.collection.immutable
class Set2

[source: `scala/collection/immutable/Set2.scala`]

@serializable
`` `class` Set2[A](elem1 : A, elem2 : A)
  `extends` Set[A]

  This class implements immutable sets with exactly two elements.

Author
  Martin Oderskty
Version
  1.0, 019/01/2007

Method Summary
`def` | + (elem : A) : Set[A] Create a new set with an additional element.
`def` | - (elem : A) : Set[A] Remove a single element from a set.
`def` | contains (elem : A) : Boolean Checks if this set contains element `elem`.
`def` | elements : Iterator[A] Creates a new iterator over all elements contained in this object.
`def` | empty [C] : Set[C]
`def` | size : Int Returns the number of elements in this set.

Methods inherited from Set
+, ++, ++, incl, incl, -, --, --, excl, excl, intersect, **, map, flatMap, filter

Methods inherited from Set
apply, isEmpty, subsetOf, equals, hashCode, toArray

Methods inherited from Collection
toString, stringPrefix

Methods inherited from Iterable
concat, ++, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, addString, addString, copyToArray, projection, hasDefiniteSize

Methods inherited from Function1
compose, andThen

Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Method Details

`` `def` empty[C] : Set[C]

Returns
  an empty set of arbitrary element type

Overrides
  Set.empty

`` `def` size : Int

  Returns the number of elements in this set.

Returns
  number of set elements.

`` `def` contains(elem : A) : Boolean

  Checks if this set contains element `elem`.

Parameters
  `elem -` the element to check for membership.
Returns
  `true` iff `elem` is contained in this set.

`` `def` +(elem : A) : Set[A]

  Create a new set with an additional element.

Overrides
  Set.+

`` `def` -(elem : A) : Set[A]

  Remove a single element from a set.

Parameters
  `elem -` the element to be removed
Returns
  a new set with the element removed.

Overrides
  Set.-

`` `def` elements : Iterator[A]

  Creates a new iterator over all elements contained in this object.

Returns
  the new iterator