scala.collection.immutable
class Map1

[source: `scala/collection/immutable/Map1.scala`]

@serializable
`` `class` Map1[A, +B](key1 : A, value1 : B)
  `extends` Map[A, B]

  This class implements immutable maps with exactly one entry

Author
  Martin Oderskty
Version
  1.0, 019/01/2007

Method Summary
`def` | - (key : A) : Map[A, B] Remove a key from this map
`def` | elements : Iterator[(A, B)] Creates a new iterator over all elements contained in this object.
`def` | empty [B] : Map[A, B] This method returns a new map instance of the same class mapping keys of the same type to values of type `C`.
`def` | get (key : A) : Option[B] Check if this map maps `key` to a value and return the value if it exists.
`def` | size : Int Compute the number of key-to-value mappings.
`def` | update [B1 >: B](key : A, value : B1) : Map[A, B1] This method allows one to create a new map with an additional mapping from `key` to `value`. If the map contains already a mapping for `key`, it will be overridden by this function.

Methods inherited from Map
+, +, ++, ++, -, --, --, withDefault, withDefaultValue, transform, filter, +, incl, incl, excl, excl, mappingToString

Methods inherited from Map
getOrElse, isEmpty, apply, contains, isDefinedAt, keys, keySet, values, equals, hashCode, toString, default, projection, filterKeys, mapElements

Methods inherited from Collection
toArray, stringPrefix, equalWith

Methods inherited from Iterable
concat, ++, map, flatMap, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, addString, addString, copyToArray, hasDefiniteSize

Methods inherited from PartialFunction
orElse, andThen

Methods inherited from Function1
compose

Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Method Details

`` `def` size : Int

  Compute the number of key-to-value mappings.

Returns
  the number of mappings

`` `def` get(key : A) : Option[B]

  Check if this map maps `key` to a value and return the value if it exists.

Parameters
  `key -` the key of the mapping of interest
Returns
  the value of the mapping, if it exists

`` `def` elements : Iterator[(A, B)]

  Creates a new iterator over all elements contained in this object.

Returns
  the new iterator

`` `def` empty[B] : Map[A, B]

  This method returns a new map instance of the same class mapping keys of the same type to values of type `C`.

Overrides
  Map.empty

`` `def` update[B1 >: B](key : A, value : B1) : Map[A, B1]

  This method allows one to create a new map with an additional mapping from `key` to `value`. If the map contains already a mapping for `key`, it will be overridden by this function.

Parameters
  `key -` ...
  `value -` ...
Returns
  the created map
Deprecated
  use `+({A, B})` instead

Overrides
  Map.update

`` `def` -(key : A) : Map[A, B]

  Remove a key from this map

Parameters
  `key -` the key to be removed
Returns
  If the map does not contain a binding for `key` it is returned unchanged. Otherwise, return a new map without a binding for `key`

Overrides
  Map.-