in scala/collection/immutable
class ListSet
-
class ListSet[A]()
- extends Object
- with ScalaObject
- with Set[A]
-
Implementing classes or objects:
-
class Node(elem: A) in scala/collection/immutable/ListSet-class
-
This class implements immutable sets using a list-based data
structure. Instances of
ListSet
represent
empty sets; they can be either created by calling the constructor
directly, or by applying the function ListSet.Empty
.
- Author:
-
Matthias Zenger
- Version:
-
1.0, 09/07/2003
Method Summary
|
|
def +(elem: A): ListSet[A]
This method creates a new set with an additional element.
|
|
def -(elem: A): ListSet[A]
- can be used to 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.
|
override
|
def equals(obj: Any): Boolean
Compares two sets for equality.
|
override
|
def hashCode(): Int
|
|
def size: Int
Returns the number of elements in this set.
|
override
|
def toList: List[A]
Transform this set into a list of all elements.
|
Methods inherited from java/lang/Object-class
|
clone, eq, finalize, getClass, notify, notifyAll, synchronized, wait, wait, wait |
Class Summary
|
protected
|
class Node(elem: A)
|
size
def size: Int
-
Returns the number of elements in this set.
- Returns:
-
number of set elements.
contains
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): ListSet[A]
-
This method creates a new set with an additional element.
-
def -(elem: A): ListSet[A]
-
-
can be used to remove a single element from
a set.
elements
def elements: Iterator[A]
-
Creates a new iterator over all elements contained in this
object.
- Returns:
-
the new iterator
toList
override def toList: List[A]
-
Transform this set into a list of all elements.
- Returns:
-
a list which enumerates all elements of this set.
equals
override def equals(obj: Any): Boolean
-
Compares two sets for equality.
Two set are equal iff they contain the same elements.
hashCode
override def hashCode(): Int