Packages

  • package root
    Definition Classes
    root
  • package strawman
    Definition Classes
    root
  • package collection

    A strawman architecture for new collections.

    A strawman architecture for new collections. It contains some example collection classes and methods with the intent to expose some key issues. It would be good to compare this to odether implementations of the same functionality, to get an idea of the strengths and weaknesses of different collection architectures.

    For a test file, see tests/run/CollectionTests.scala.

    Strawman6 is like strawman5, and adds lazy lists (i.e. lazie streams), arrays and some utilitity methods (take, tail, mkString, toArray). Also, systematically uses builders for all strict collections.

    Types covered in this strawman:

    1. Collection base types:

    IterableOnce, Iterable, Seq, LinearSeq, View, IndexedView

    2. Collection creator base types:

    FromIterable, IterableFactory, Buildable, Builder

    3. Types that bundle operations:

    IterableOps, IterableMonoTransforms, IterablePolyTransforms, IterableLike SeqMonoTransforms, SeqLike

    4. Concrete collection types:

    List, LazyList, ListBuffer, ArrayBuffer, ArrayBufferView, StringView, ArrayView

    5. Decorators for existing types

    StringOps, ArrayOps

    6. Related non collection types:

    Iterator, StringBuilder

    Operations covered in this strawman:

    1. Abstract operations, or expected to be overridden:

    For iterables:

    iterator, fromIterable, fromIterableWithSameElemType, knownLength, className

    For sequences:

    apply, length

    For buildables:

    newBuilder

    For builders:

    +=, result

    2. Utility methods, might be overridden for performance:

    Operations returning not necessarily a collection:

    foreach, foldLeft, foldRight, indexWhere, isEmpty, head, size, mkString

    Operations returning a collection of a fixed type constructor:

    view, to, toArray, copyToArray

    Type-preserving generic transforms:

    filter, partition, take, drop, tail, reverse

    Generic transforms returning collections of different element types:

    map, flatMap, ++, zip

    Definition Classes
    strawman
  • package mutable
    Definition Classes
    collection
  • ArrayBuffer
  • ArrayBufferView
  • BitSet
  • Buildable
  • Builder
  • Growable
  • GrowableSeq
  • HashMap
  • HashSet
  • IndexedOptimizedGrowableSeq
  • IndexedOptimizedSeq
  • Iterable
  • ListBuffer
  • Map
  • MapLike
  • RefArrayUtils
  • Seq
  • Set
  • SetLike
  • SetMonoTransforms
  • SortedSet
  • SortedSetLike
  • StringBuilder

final class HashSet[A] extends Set[A] with SetLike[A, HashSet] with Buildable[A, HashSet[A]] with Builder[A, HashSet[A]]

Mutable set backed by a hash trie

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HashSet
  2. Builder
  3. Buildable
  4. Set
  5. Growable
  6. SetLike
  7. SetMonoTransforms
  8. Set
  9. SetLike
  10. Equals
  11. SetMonoTransforms
  12. Iterable
  13. IterableLike
  14. IterablePolyTransforms
  15. IterableMonoTransforms
  16. IterableOps
  17. FromIterable
  18. IterableOnce
  19. AnyRef
  20. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HashSet()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def &(that: collection.Set[A]): HashSet[A]
    Definition Classes
    HashSetSetMonoTransforms
  4. def ++(that: collection.Set[A]): HashSet[A]
    Definition Classes
    HashSetSetMonoTransforms
  5. def ++[B >: A](xs: IterableOnce[B]): HashSet[B]

    Concatenation

    Concatenation

    Definition Classes
    IterablePolyTransforms
  6. def ++=(xs: IterableOnce[A]): HashSet.this.type

    ${Add}s all elements produced by a TraversableOnce to this $coll.

    ${Add}s all elements produced by a TraversableOnce to this $coll.

    xs

    the TraversableOnce producing the elements to $add.

    returns

    the $coll itself.

    Definition Classes
    Growable
  7. def +=(elem: A): HashSet.this.type

    Append an element

    Append an element

    returns

    the $coll itself

    Definition Classes
    HashSetBuilderSetGrowable
  8. def +=(elem1: A, elem2: A, elems: A*): HashSet.this.type

    ${Add}s two or more elements to this $coll.

    ${Add}s two or more elements to this $coll.

    elem1

    the first element to $add.

    elem2

    the second element to $add.

    elems

    the remaining elements to $add.

    returns

    the $coll itself

    Definition Classes
    Growable
  9. def -=(elem: A): HashSet.this.type
    Definition Classes
    HashSetSet
  10. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def canEqual(that: Any): Boolean
    Definition Classes
    SetLike → Equals
  13. def className: String

    The class name of this collection.

    The class name of this collection. To be used for converting to string. Collections generally print like this:

    <className>(elem_1, ..., elem_n)

    Definition Classes
    IterableOps
  14. def clear(): Unit

    Clears the contents of this builder.

    Clears the contents of this builder. After execution of this method the builder will contain no elements.

    Definition Classes
    HashSetBuilderGrowable
  15. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. def coll: HashSet.this.type

    The collection itself

    The collection itself

    Attributes
    protected
    Definition Classes
    IterableIterablePolyTransformsIterableMonoTransformsIterableOps
  17. def contains(elem: A): Boolean
    Definition Classes
    HashSetSetSetLike
  18. def copyToArray[B >: A](xs: Array[B], start: Int = 0): xs.type

    Copy all elements of this collection to array xs, starting at start.

    Copy all elements of this collection to array xs, starting at start.

    Definition Classes
    IterableOps
  19. def drop(n: Int): HashSet[A @scala.annotation.unchecked.uncheckedVariance]

    The rest of the collection without its n first elements.

    The rest of the collection without its n first elements. For linear, immutable collections this should avoid making a copy.

    Definition Classes
    IterableMonoTransforms
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(that: Any): Boolean
    Definition Classes
    SetLike → Equals → AnyRef → Any
  22. def filter(p: (A) ⇒ Boolean): HashSet[A @scala.annotation.unchecked.uncheckedVariance]

    All elements satisfying predicate p

    All elements satisfying predicate p

    Definition Classes
    IterableMonoTransforms
  23. def filterInPlace(p: (A) ⇒ Boolean): Unit
    Definition Classes
    Set
  24. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. def flatMap[B](f: (A) ⇒ IterableOnce[B]): HashSet[B]

    Flatmap

    Flatmap

    Definition Classes
    IterablePolyTransforms
  26. def flatMapInPlace(f: (A) ⇒ IterableOnce[A]): Unit
    Definition Classes
    Set
  27. def foldLeft[B](z: B)(op: (B, A) ⇒ B): B

    Fold left

    Fold left

    Definition Classes
    IterableOps
  28. def foldRight[B](z: B)(op: (A, B) ⇒ B): B

    Fold right

    Fold right

    Definition Classes
    IterableOps
  29. def foreach[U](f: (A) ⇒ U): Unit

    Apply f to each element for its side effects Note: [U] parameter needed to help scalac's type inference.

    Apply f to each element for its side effects Note: [U] parameter needed to help scalac's type inference.

    Definition Classes
    IterableOps
  30. def fromIterable[B](coll: collection.Iterable[B]): HashSet[B]
    Definition Classes
    HashSetIterablePolyTransformsFromIterable
  31. def fromIterableWithSameElemType(coll: collection.Iterable[A]): HashSet[A]

    Create a collection of type C[A] from the elements of coll, which has the same element type as this collection.

    Create a collection of type C[A] from the elements of coll, which has the same element type as this collection. Overridden in StringOps and ArrayOps.

    Attributes
    protected[this]
    Definition Classes
    HashSetIterableLikeIterableMonoTransforms
  32. def get(elem: A): Option[A]
    Definition Classes
    HashSetSet
  33. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  34. def hashCode(): Int
    Definition Classes
    SetLike → AnyRef → Any
  35. def head: A

    The first element of the collection.

    The first element of the collection.

    Definition Classes
    IterableOps
  36. def indexWhere(p: (A) ⇒ Boolean): Int

    The index of the first element in this collection for which p holds.

    The index of the first element in this collection for which p holds.

    Definition Classes
    IterableOps
  37. def insert(elem: A): Boolean
    Definition Classes
    Set
  38. def isEmpty: Boolean

    Is the collection empty?

    Is the collection empty?

    Definition Classes
    IterableOps
  39. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  40. def iterator(): Iterator[A]

    Iterator can be used only once

    Iterator can be used only once

    Definition Classes
    HashSetIterableOnce
  41. def knownSize: Int

    The number of elements in this collection, if it can be cheaply computed, -1 otherwise.

    The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

    Definition Classes
    IterableOps
  42. def map[B](f: (A) ⇒ B): HashSet[B]

    Map

    Map

    Definition Classes
    IterablePolyTransforms
  43. def mapInPlace(f: (A) ⇒ A): Unit
    Definition Classes
    Set
  44. def mapResult[NewTo](f: (HashSet[A]) ⇒ NewTo): Builder[A, NewTo]

    A builder resulting from this builder my mapping the result using f.

    A builder resulting from this builder my mapping the result using f.

    Definition Classes
    Builder
  45. def mkString(sep: String): String

    A string showing all elements of this collection, separated by string sep.

    A string showing all elements of this collection, separated by string sep.

    Definition Classes
    IterableOps
  46. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  47. def newBuilder: Builder[A, HashSet[A]]

    Creates a new builder.

    Creates a new builder.

    Attributes
    protected[this]
    Definition Classes
    HashSetBuildable
  48. def nonEmpty: Boolean

    Is the collection not empty?

    Is the collection not empty?

    Definition Classes
    IterableOps
  49. final def notify(): Unit
    Definition Classes
    AnyRef
  50. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  51. def partition(p: (A) ⇒ Boolean): (HashSet[A], HashSet[A])

    Optimized, push-based version of partition.

    Optimized, push-based version of partition.

    Definition Classes
    BuildableIterableMonoTransforms
  52. def remove(elem: A): Option[A]
    Definition Classes
    Set
  53. def result: HashSet[A]

    Result collection consisting of all elements appended so far.

    Result collection consisting of all elements appended so far.

    Definition Classes
    HashSetBuilder
  54. def size: Int

    The number of elements in this collection.

    The number of elements in this collection. Does not terminate for infinite collections.

    Definition Classes
    IterableOps
  55. def subsetOf(that: collection.Set[A]): Boolean
    Definition Classes
    HashSetSetLike
  56. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  57. def tail: HashSet[A @scala.annotation.unchecked.uncheckedVariance]

    The rest of the collection without its first element.

    The rest of the collection without its first element.

    Definition Classes
    IterableMonoTransforms
  58. def take(n: Int): HashSet[A @scala.annotation.unchecked.uncheckedVariance]

    A collection containing the first n elements of this collection.

    A collection containing the first n elements of this collection.

    Definition Classes
    IterableMonoTransforms
  59. def to[C[X] <: collection.Iterable[X]](fi: FromIterable[C]): C[A]

    Given a collection factory fi for collections of type constructor C, convert this collection to one of type C[A].

    Given a collection factory fi for collections of type constructor C, convert this collection to one of type C[A]. Example uses:

    xs.to(List) xs.to(ArrayBuffer)

    Definition Classes
    IterableOps
  60. def toArray[B >: A](implicit arg0: ClassTag[B]): Array[B]

    Convert collection to array.

    Convert collection to array.

    Definition Classes
    IterableOps
  61. def toString(): String
    Definition Classes
    IterableOps → Any
  62. def view: View[A]

    A view representing the elements of this collection.

    A view representing the elements of this collection.

    Definition Classes
    IterableOps
  63. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. def zip[B](xs: IterableOnce[B]): HashSet[(A, B)]

    Zip.

    Zip. Interesting because it requires to align to source collections.

    Definition Classes
    IterablePolyTransforms

Inherited from Builder[A, HashSet[A]]

Inherited from Buildable[A, HashSet[A]]

Inherited from Set[A]

Inherited from Growable[A]

Inherited from SetLike[A, HashSet]

Inherited from SetMonoTransforms[A, HashSet[A]]

Inherited from collection.Set[A]

Inherited from collection.SetLike[A, HashSet]

Inherited from Equals

Inherited from collection.SetMonoTransforms[A, HashSet[A]]

Inherited from collection.Iterable[A]

Inherited from IterableLike[A, HashSet]

Inherited from IterablePolyTransforms[A, HashSet]

Inherited from IterableMonoTransforms[A, HashSet[A @scala.annotation.unchecked.uncheckedVariance]]

Inherited from IterableOps[A]

Inherited from FromIterable[HashSet]

Inherited from IterableOnce[A]

Inherited from AnyRef

Inherited from Any

Ungrouped