implicit class OptMapAttr2MapOps[T] extends AnyRef
Implicit convenience ops on Option[Map[String, T]]
- Source
- OptionalMapOps.scala
- Alphabetic
- By Inheritance
- OptMapAttr2MapOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new OptMapAttr2MapOps(mapAttr: Option[Map[String, T]])
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 at(key: String): Option[T]
Extract optional value at key.
Extract optional value at key.
Ns.int.strMap$ insert List( (1, Some(Map("en" -> "Hi there"))), (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))), (3, Some(Map("da" -> "Hejsa"))) ) // Value from key with flatMap and get Ns.int.strMap$.get.map { case (i, s) => (i, s.flatMap(_.get("en"))) } === List( (1, Some("Hi there")), (2, Some("Oh, Hi")), (3, None) ) // Value `at` key convenience method Ns.int.strMap$.get.map { case (i, s) => (i, s.at("en")) } === List( (1, Some("Hi there")), (2, Some("Oh, Hi")), (3, None) )
- key
Key of key/value pairs to look for
- returns
Optional value
- def atOrElse(key: String, default: T): T
Extract value at key or a default value.
Extract value at key or a default value.
Ns.int.strMap$ insert List( (1, Some(Map("en" -> "Hi there"))), (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))), (3, Some(Map("da" -> "Hejsa"))) ) // Value `at` key or default value Ns.int.strMap$.get.map { case (i, s) => (i, s.atOrElse("en", "Default")) } === List( (1, "Hi there"), (2, "Oh, Hi"), (3, "Default") )
- key
Key to match
- default
Default value if key is not found
- returns
Value if present, otherwise default value supplied
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def keyValue(keyValueRegExs: (String, T)*): Map[String, T]
Maps filtered by pairs of (key -> value-regex).
Maps filtered by pairs of (key -> value-regex).
Ns.int.strMap$ insert List( (1, Some(Map("en" -> "Hi there"))), (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))), (4, Some(Map("da" -> "Hejsa"))) ) // Maps filtered by key and value Ns.int.strMap$.get.map { case (i, s) => (i, s.keyValue("en" -> "he")) } === List( (1, Map("en" -> "Hi there")), (2, Map()), (3, Map()) )
- keyValueRegExs
One or more (key -> value-regex) pairs
- returns
Maps filtered by keys/regexes
- def keyValues(keyValuesRegEx: (String, Seq[T]), keyValuesRegExs: (String, Seq[T])*): Map[String, T]
Maps filtered by pairs of (key -> Seq(value-regexes)).
Maps filtered by pairs of (key -> Seq(value-regexes)).
Ns.int.strMap$ insert List( (1, Some(Map("en" -> "Hi there"))), (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))), (3, Some(Map("da" -> "Hejsa"))) ) // Maps filtered by key and value Ns.int.strMap$.get.map { case (i, s) => (i, s.keyValues("en" -> Seq("he", "hi"))) } === List( (1, Map("en" -> "Hi there")), (2, Map("en" -> "Oh, Hi")), (3, Map()) )
- keyValuesRegEx
(key -> Seq(value-regex)) pair
- keyValuesRegExs
Optional further (key -> Seq(value-regex)) pairs
- returns
Map filtered by keys/regexes
- def mapAt(key1: String, keyN: String*): Map[String, T]
Maps filtered by keys.
Maps filtered by keys.
Ns.int.strMap$ insert List( (1, Some(Map("en" -> "Hi there"))), (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))), (3, Some(Map("da" -> "Hejsa"))) ) // Map values filtered by keys Ns.int.strMap$.get.map { case (i, s) => (i, s.mapAt("fr", "da")) } === List( (1, Map()), (2, Map("fr" -> "Bonjour")), (3, Map("da" -> "Hejsa")) )
- key1
Key to match
- keyN
Optional further keys to match
- returns
Maps filtered with pairs matching keys
- 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
- def values(valueRegEx: T, valueRegExs: T*): Map[String, T]
Maps filtered by regexes on values.
Maps filtered by regexes on values.
Ns.int.strMap$ insert List( (1, Some(Map("en" -> "Hi there"))), (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))), (3, Some(Map("da" -> "Hejsa"))) ) // Maps filtered by regex on values Ns.int.strMap$.get.map { case (i, s) => (i, s.values("jou")) } === List( (1, Map()), (2, Map("fr" -> "Bonjour")), (3, Map()) ) // Maps filtered by regexes on value Ns.int.strMap$.get.map { case (i, s) => (i, s.values("jou", "hej")) } === List( (1, Map()), (2, Map("fr" -> "Bonjour")), (3, Map("da" -> "Hejsa")) )
- valueRegEx
Regex on values
- valueRegExs
Optional further regexes on values
- returns
Map with pairs having values matching regexes
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Documentation/API for the Molecule library - a meta DSL for the Datomic database.
Manual | scalamolecule.org | Github | Forum