scala.collection.mutable

class LinkedHashMap

[source: scala/collection/mutable/LinkedHashMap.scala]

@serializable

class LinkedHashMap[A, B]
extends Map[A, B] with MapLike[A, B, LinkedHashMap[A, B]] with HashTable[A]
Since
2.7
Type Summary
type Entry
Value Summary
protected var firstEntry : LinkedEntry
protected var lastEntry : LinkedEntry
Values and Variables inherited from HashTable
loadFactorDenum, table, tableSize, threshold
Method Summary
def += (kv : (A, B)) : LinkedHashMap[A, B]
Add a new key/value mapping this map.
def -= (key : A) : LinkedHashMap[A, B]
Delete a key from this map if it is present.
override def clear : Unit
Removes all elements from the set. After this operation is completed, the set will be empty.
override def empty : LinkedHashMap[A, B]
override def foreach [U](f : ((A, B)) => U) : Unit
Apply a function f to all elements of this iterable object.
def get (key : A) : Option[B]
Check if this map maps key to a value and return the value as an option if it exists, None if not.
def iterator : Iterator[(A, B)]
An iterator yielding all key/value mappings of this map.
override def keysIterator : Iterator[A]
Creates an iterator for all keys.
override def put (key : A, value : B) : Option[B]
Adds a new mapping from key to value to the map. If the map already contains a mapping for key, it will be overridden.
override def remove (key : A) : Option[B]
If given key is defined in this map, remove it and return associated value as an Option. If key is not present return None.
override def size : Int
The number of elements in this collection
override def valuesIterator : Iterator[B]
Creates an iterator for a contained values.
Methods inherited from HashTable
loadFactor, initialSize, initialThreshold, findEntry, addEntry, removeEntry, entriesIterator, entries, clearTable, elemEquals, elemHashCode, improve, index
Methods inherited from MapLike
newBuilder, update, updated, cached, +, +, ++, ++, -, removeKey, getOrElseUpdate, transform, retain, clone, result, -, --, --
Methods inherited from Shrinkable
-=, --=, --=
Methods inherited from Builder
sizeHint, mapResult
Methods inherited from Growable
+=, ++=, ++=
Methods inherited from MapLikeBase
+
Methods inherited from MapLike
isEmpty, getOrElse, apply, contains, isDefinedAt, keySet, keys, valuesIterable, values, default, filterKeys, mapValues, mapElements, +, ++, ++, addString, stringPrefix, toString, hashCode, equals
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from Iterable
companion
Methods inherited from IterableLike
thisCollection, toCollection, elements, forall, exists, find, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, view, view, first, firstOption, projection
Methods inherited from GenericTraversableTemplate
genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableLike
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toList, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, withFilter
Methods inherited from AnyRef
getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Type Details
type Entry

Value Details
protected var firstEntry : LinkedEntry

protected var lastEntry : LinkedEntry

Method Details
override def empty : LinkedHashMap[A, B]
Overrides
Map.empty

override def size : Int
The number of elements in this collection

def get(key : A) : Option[B]
Check if this map maps key to a value and return the value as an option if it exists, None if not.
Parameters
key - the key of the mapping of interest.
Returns
the value of the mapping as an option, if it exists, or None.

override def put(key : A, value : B) : Option[B]
Adds a new mapping from key to value to the map. If the map already contains a mapping for key, it will be overridden.
Parameters
key - The key to update
value - The new value
Overrides
MapLike.put

override def remove(key : A) : Option[B]
If given key is defined in this map, remove it and return associated value as an Option. If key is not present return None.
Parameters
key - the key to be removed
Overrides
MapLike.remove

def +=(kv : (A, B)) : LinkedHashMap[A, B]
Add a new key/value mapping this map.
Parameters
kv - the key/value pair.
Returns
the map itself
Overrides
MapLike.+=

def -=(key : A) : LinkedHashMap[A, B]
Delete a key from this map if it is present.
Parameters
key - the key to be removed
Notes
same as `delete`.
Overrides
MapLike.-=

def iterator : Iterator[(A, B)]
An iterator yielding all key/value mappings of this map.

override def keysIterator : Iterator[A]
Creates an iterator for all keys.
Returns
an iterator over all keys.

override def valuesIterator : Iterator[B]
Creates an iterator for a contained values.
Returns
an iterator over all values.

override def foreach[U](f : ((A, B)) => U) : Unit
Apply a function f to all elements of this iterable 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.

override def clear : Unit
Removes all elements from the set. After this operation is completed, the set will be empty.
Overrides
MapLike.clear