trait TypedMap extends AnyRef
A TypedMap is an immutable map containing typed values. Each entry is
associated with a TypedKey that can be used to look up the value. A
TypedKey
also defines the type of the value, e.g. a TypedKey[String]
would be associated with a String
value.
Instances of this class are created with the TypedMap.empty
method.
The elements inside TypedMaps cannot be enumerated. This is a decision designed to enforce modularity. It's not possible to accidentally or intentionally access a value in a TypedMap without holding the corresponding TypedKey.
- Source
- TypedMap.scala
- Alphabetic
- By Inheritance
- TypedMap
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
+(entries: TypedEntry[_]*): TypedMap
Update the map with several entries, returning a new instance of the map.
Update the map with several entries, returning a new instance of the map.
- entries
The new entries to add to the map.
- returns
A new instance of the map with the new entries added.
-
abstract
def
-(keys: TypedKey[_]*): TypedMap
Removes keys from the map, returning a new instance of the map.
Removes keys from the map, returning a new instance of the map.
- keys
The keys to remove.
- returns
A new instance of the map with the entries removed.
-
abstract
def
apply[A](key: TypedKey[A]): A
Get a value from the map, throwing an exception if it is not present.
Get a value from the map, throwing an exception if it is not present.
- A
The type of value to retrieve.
- key
The key for the value to retrieve.
- returns
The value, if it is present in the map.
- Exceptions thrown
scala.NoSuchElementException
If the value isn't present in the map.
-
abstract
def
contains(key: TypedKey[_]): Boolean
Check if the map contains a value with the given key.
Check if the map contains a value with the given key.
- key
The key to check for.
- returns
True if the value is present, false otherwise.
-
abstract
def
get[A](key: TypedKey[A]): Option[A]
Get a value from the map, returning
None
if it is not present.Get a value from the map, returning
None
if it is not present.- A
The type of value to retrieve.
- key
The key for the value to retrieve.
- returns
Some
value, if it is present in the map, otherwiseNone
.
-
abstract
def
updated[A](key: TypedKey[A], value: A): TypedMap
Update the map with the given key and value, returning a new instance of the map.
Update the map with the given key and value, returning a new instance of the map.
- A
The type of value.
- key
The key to set.
- value
The value to use.
- returns
A new instance of the map with the new entry added.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: libs.typedmap.TypedMap
- returns
The Java version for this map.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()