scala.collection.immutable.Set

class Set1

[source: scala/collection/immutable/Set.scala]

@serializable

class Set1[A](elem1 : A)
extends Set[A]
An optimized representation for immutable sets of size 1
Method Summary
def + (elem : A) : Set[A]
Creates a new set with an additional element, unless the element is already present.
def - (elem : A) : Set[A]
Creates a new set with given element removed from this set, unless the element is not present.
def contains (elem : A) : Boolean
Checks if this set contains element elem.
override def foreach [U](f : (A) => U) : Unit
Apply a function f to all elements of this traversable object.
def iterator : Iterator[A]
Creates a new iterator over all elements contained in this iterable object.
override def size : Int
The number of elements in this collection
Methods inherited from Set
companion, hashCode
Methods inherited from SetTemplate
newBuilder, isEmpty, apply, intersect, &, **, union, |, diff, &~, subsetOf, equals, stringPrefix, toString
Methods inherited from Subtractable
-, --, --
Methods inherited from Addable
+, ++, ++
Methods inherited from SetClass
empty
Methods inherited from Function1
compose, andThen
Methods inherited from IterableTemplate
elements, foldRight, reduceRight, toIterable, head, takeRight, dropRight, sameElements, toStream, view, view, first, firstOption, toSeq, projection
Methods inherited from TraversableClass
genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableTemplate
thisCollection, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterMap, filterNot, remove, partition, groupBy, forall, exists, count, find, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, headOption, tail, last, lastOption, init, take, drop, slice, takeWhile, dropWhile, span, splitAt, copyToBuffer, copyToArray, copyToArray, toArray, toList, toSequence, toSet, mkString, mkString, mkString, addString, addString, addString
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def size : Int
The number of elements in this collection

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]
Creates a new set with an additional element, unless the element is already present.
Parameters
elem - the element to be added

def -(elem : A) : Set[A]
Creates a new set with given element removed from this set, unless the element is not present.
Parameters
elem - the element to be removed

def iterator : Iterator[A]
Creates a new iterator over all elements contained in this iterable object.
Returns
the new iterator

override def foreach[U](f : (A) => U) : Unit
Apply a function f to all elements of this traversable object.
Parameters
f - A function that is applied for its side-effect to every element. The result (of arbitrary type U) of function `f` is discarded.
Notes
This method underlies the implementation of most other bulk operations. Implementing `foreach` with `iterator` is often suboptimal. So `foreach` should be overridden in concrete collection classes if a more efficient implementation is available.