Scala Library
|
|
scala/collection/immutable/LongMap.scala
]
sealed abstract
class
LongMap[+T]
extends
Map[Long, T] with
MapLike[Long, T, LongMap[T]]Method Summary | |
def
|
+
[S >: T](kv : (Long, S)) : LongMap[S]
Add a key/value pair to this map, returning a new map.
|
def
|
++ [S >: T](that : LongMap[S]) : LongMap[S] |
def
|
-
(key : Long) : LongMap[T]
Removes a key from this map, returning a new map
|
override final def
|
apply
(key : Long) : T
Retrieve the value which is associated with the given key. This
method throws an exception if there is no mapping from the given
key to a value.
|
override def
|
empty : LongMap[T] |
override def
|
filter
(f : ((Long, T)) => Boolean) : LongMap[T]
Returns all the elements of this traversable that satisfy the
predicate
p . The order of the elements is preserved. |
override final def
|
foreach
[U](f : ((Long, T)) => U) : Unit
Loops over the key, value pairs of the map in unsigned order of the keys.
|
final def
|
foreachKey
(f : (Long) => Unit) : Unit
Loop over the keys of the map. The same as keys.foreach(f), but may
be more efficient.
|
final def
|
foreachValue
(f : (T) => Unit) : Unit
Loop over the keys of the map. The same as keys.foreach(f), but may
be more efficient.
|
final def
|
get
(key : Long) : Option[T]
Check if this map maps
key to a value and return the
value as an option if it exists, None if not. |
override final def
|
getOrElse
[S >: T](key : Long, default : => S) : S
Check if this map maps
key to a value.
Return that value if it exists, otherwise return default . |
def
|
intersection
[R](that : LongMap[R]) : LongMap[T]
Left biased intersection. Returns the map that has all the same mappings as this but only for keys
which are present in the other map.
|
def
|
intersectionWith
[S, R](that : LongMap[S], f : (Long, T, S) => R) : LongMap[R]
Forms the intersection of these two maps with a combinining function. The resulting map is
a map that has only keys present in both maps and has values produced from the original mappings
by combining them with f.
|
override def
|
isEmpty
: Boolean
Is this an empty map?
|
def
|
iterator
: Iterator[(Long, T)]
Iterator over key, value pairs of the map in unsigned order of the keys.
|
override def
|
keysIterator
: Iterator[Long]
Creates an iterator for all keys.
|
def
|
modifyOrRemove
[S](f : (Long, T) => Option[S]) : LongMap[S]
A combined transform and filter function. Returns an LongMap such that for each (key, value) mapping
in this map, if f(key, value) == None the map contains no mapping for key, and if
f(key, value) |
override final def
|
size
: Int
The number of elements in this collection
|
override def
|
stringPrefix
: java.lang.String
Defines the prefix of this object's
toString representation.
!!! todo: remove stringPrefix overrides where possible |
override def
|
toList
: List[(Long, T)]
Returns a list with all elements of this traversable object.
|
def
|
transform [S](f : (Long, T) => S) : LongMap[S] |
def
|
unionWith
[S >: T](that : LongMap[S], f : (Long, S, S) => S) : LongMap[S]
Forms a union map with that map, using the combining function to resolve conflicts.
|
override def
|
update [S >: T](key : Long, value : S) : LongMap[S] |
def
|
updateWith
[S >: T](key : Long, value : S, f : (T, S) => S) : LongMap[S]
Updates the map, using the provided function to resolve conflicts if the key is already present.
Equivalent to
this.get(key) match { case None => this.update(key, value); case Some(oldvalue) => this.update(key, f(oldvalue, value) } |
override def
|
updated
[S >: T](key : Long, value : S) : LongMap[S]
Add a key/value pair to this map.
|
override def
|
valuesIterator
: Iterator[T]
Creates an iterator for a contained values.
|
Methods inherited from Map | |
withDefault, withDefaultValue |
Methods inherited from MapLike | |
+, ++, ++, transform, filterNot |
Methods inherited from MapLike | |
newBuilder, contains, isDefinedAt, keySet, keys, valuesIterable, values, default, filterKeys, mapValues, mapElements, addString, toString, hashCode, equals |
Methods inherited from Subtractable | |
-, --, -- |
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, 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, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, withFilter |
Methods inherited from AnyRef | |
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
f -
The loop bodyf -
The loop bodyoverride
def
stringPrefix : java.lang.String
toString
representation.
!!! todo: remove stringPrefix overrides where possibleoverride
def
isEmpty : Boolean
true
iff the map does not contain any key/value mapping.p
. The order of the elements is preserved.p -
the predicate used to filter the traversable.p
.override final
def
size : Int
key
to a value and return the
value as an option if it exists, None if not.key -
the key of the mapping of interest.key
to a value.
Return that value if it exists, otherwise return default
.key -
the key.default -
a computation that yields a default value in case no binding for the key is found in the map.key -
the keykv -
the key/value pairkey -
the keyvalue -
the valueoverride
def
update[S >: T](key : Long, value : S) : LongMap[S]
this.get(key) match { case None => this.update(key, value); case Some(oldvalue) => this.update(key, f(oldvalue, value) }
key -
The key to updatevalue -
The value to use if there is no conflictf -
The function used to resolve conflicts.key -
the key to be removedkey
f(key, value)
f -
The transforming function.that -
the map to form a union with.f -
the function used to resolve conflicts between two mappings.that -
The map to intersect with.f -
The combining function.that -
The map to intersect with.
Scala Library
|
|