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 HashMap[K, V] extends Map[K, V] with MapLike[K, V, HashMap]

A mutable map backed by a hashtable

Linear Supertypes
Map[K, V], MapLike[K, V, HashMap], Growable[(K, V)], Iterable[(K, V)], collection.Map[K, V], collection.MapLike[K, V, HashMap], MapPolyTransforms[K, V, HashMap], collection.Iterable[(K, V)], IterableLike[(K, V), Iterable], IterablePolyTransforms[(K, V), Iterable], IterableMonoTransforms[(K, V), HashMap[K, V @scala.annotation.unchecked.uncheckedVariance]], IterableOps[(K, V)], FromIterable[Iterable], IterableOnce[(K, V)], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HashMap
  2. Map
  3. MapLike
  4. Growable
  5. Iterable
  6. Map
  7. MapLike
  8. MapPolyTransforms
  9. Iterable
  10. IterableLike
  11. IterablePolyTransforms
  12. IterableMonoTransforms
  13. IterableOps
  14. FromIterable
  15. IterableOnce
  16. AnyRef
  17. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HashMap()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def ++[B >: (K, V)](xs: IterableOnce[B]): Iterable[B]

    Concatenation

    Concatenation

    Definition Classes
    IterablePolyTransforms
  4. def ++=(xs: IterableOnce[(K, V)]): HashMap.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
  5. def +=(elem: (K, V)): HashMap.this.type

    ${Add}s a single element to this $coll.

    ${Add}s a single element to this $coll.

    elem

    the element to $add.

    returns

    the $coll itself

    Definition Classes
    HashMapGrowable
  6. def +=(elem1: (K, V), elem2: (K, V), elems: (K, V)*): HashMap.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
  7. def -=(elem: (K, V)): HashMap.this.type
    Definition Classes
    HashMapMapLike
  8. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. 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
  11. def clear(): Unit

    Clears the $coll's contents.

    Clears the $coll's contents. After this operation, the $coll is empty.

    Definition Classes
    HashMapGrowable
  12. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def coll: HashMap.this.type

    The collection itself

    The collection itself

    Attributes
    protected
    Definition Classes
    IterableIterablePolyTransformsIterableMonoTransformsIterableOps
  14. def copyToArray[B >: (K, V)](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
  15. def drop(n: Int): HashMap[K, V @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
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  18. def filter(p: ((K, V)) ⇒ Boolean): HashMap[K, V @scala.annotation.unchecked.uncheckedVariance]

    All elements satisfying predicate p

    All elements satisfying predicate p

    Definition Classes
    IterableMonoTransforms
  19. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def flatMap[K2, V2](f: (K, V) ⇒ IterableOnce[(K2, V2)]): HashMap[K2, V2]
    Definition Classes
    HashMapMapPolyTransforms
  21. def flatMap[B](f: ((K, V)) ⇒ IterableOnce[B]): Iterable[B]

    Flatmap

    Flatmap

    Definition Classes
    IterablePolyTransforms
  22. def foldLeft[B](z: B)(op: (B, (K, V)) ⇒ B): B

    Fold left

    Fold left

    Definition Classes
    IterableOps
  23. def foldRight[B](z: B)(op: ((K, V), B) ⇒ B): B

    Fold right

    Fold right

    Definition Classes
    IterableOps
  24. def foreach[U](f: ((K, V)) ⇒ 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
  25. def fromIterable[B](coll: collection.Iterable[B]): Iterable[B]
    Definition Classes
    HashMapIterablePolyTransformsFromIterable
  26. def fromIterableWithSameElemType(coll: collection.Iterable[(K, V)]): HashMap[K, V]

    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
    HashMapIterableLikeIterableMonoTransforms
  27. def get(key: K): Option[V]
    Definition Classes
    HashMapMapLike
  28. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  29. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  30. def head: (K, V)

    The first element of the collection.

    The first element of the collection.

    Definition Classes
    IterableOps
  31. def indexWhere(p: ((K, V)) ⇒ 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
  32. def isEmpty: Boolean

    Is the collection empty?

    Is the collection empty?

    Definition Classes
    IterableOps
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. def iterator(): Iterator[(K, V)]

    Iterator can be used only once

    Iterator can be used only once

    Definition Classes
    HashMapIterableOnce
  35. 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
  36. def map[K2, V2](f: (K, V) ⇒ (K2, V2)): HashMap[K2, V2]
    Definition Classes
    HashMapMapPolyTransforms
  37. def map[B](f: ((K, V)) ⇒ B): Iterable[B]

    Map

    Map

    Definition Classes
    IterablePolyTransforms
  38. 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
  39. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. def nonEmpty: Boolean

    Is the collection not empty?

    Is the collection not empty?

    Definition Classes
    IterableOps
  41. final def notify(): Unit
    Definition Classes
    AnyRef
  42. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  43. def partition(p: ((K, V)) ⇒ Boolean): (HashMap[K, V @scala.annotation.unchecked.uncheckedVariance], HashMap[K, V @scala.annotation.unchecked.uncheckedVariance])

    A pair of, first, all elements that satisfy prediacte p and, second, all elements that do not.

    A pair of, first, all elements that satisfy prediacte p and, second, all elements that do not. Interesting because it splits a collection in two.

    The default implementation provided here needs to traverse the collection twice. Strict collections have an overridden version of partition in Buildable, which requires only a single traversal.

    Definition Classes
    IterableMonoTransforms
  44. def put(key: K, value: V): Option[V]
    Definition Classes
    HashMapMapLike
  45. 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
  46. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  47. def tail: HashMap[K, V @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
  48. def take(n: Int): HashMap[K, V @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
  49. def to[C[X] <: collection.Iterable[X]](fi: FromIterable[C]): C[(K, V)]

    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
  50. def toArray[B >: (K, V)](implicit arg0: ClassTag[B]): Array[B]

    Convert collection to array.

    Convert collection to array.

    Definition Classes
    IterableOps
  51. def toString(): String
    Definition Classes
    IterableOps → Any
  52. def view: View[(K, V)]

    A view representing the elements of this collection.

    A view representing the elements of this collection.

    Definition Classes
    IterableOps
  53. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. def zip[B](xs: IterableOnce[B]): Iterable[((K, V), B)]

    Zip.

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

    Definition Classes
    IterablePolyTransforms

Inherited from Map[K, V]

Inherited from MapLike[K, V, HashMap]

Inherited from Growable[(K, V)]

Inherited from Iterable[(K, V)]

Inherited from collection.Map[K, V]

Inherited from collection.MapLike[K, V, HashMap]

Inherited from MapPolyTransforms[K, V, HashMap]

Inherited from collection.Iterable[(K, V)]

Inherited from IterableLike[(K, V), Iterable]

Inherited from IterablePolyTransforms[(K, V), Iterable]

Inherited from IterableMonoTransforms[(K, V), HashMap[K, V @scala.annotation.unchecked.uncheckedVariance]]

Inherited from IterableOps[(K, V)]

Inherited from FromIterable[Iterable]

Inherited from IterableOnce[(K, V)]

Inherited from AnyRef

Inherited from Any

Ungrouped