StringMap

open class StringMap : MapBase

A map from key type string to value type string.

  • An immutable empty StringMap.

    Declaration

    Swift

    public static let empty: StringMap
  • Construct a new map with size of zero and optional initial capacity. A map can expand in size beyond its initial capacity, but best performance will be obtained if the initial capacity is close to (and not less than) the map’s maximum size.

    Declaration

    Swift

    public init(capacity: Int = (16 as Int))

    Parameters

    capacity

    Optional initial capacity.

  • Declaration

    Swift

    open class func concurrent() -> StringMap

    Return Value

    A thread-safe, concurrent map.

  • Declaration

    Swift

    open func containsValue(forKey key: String) -> Bool

    Parameters

    key

    Entry key.

    Return Value

    true if this map has an entry with the specified key, otherwise false.

  • Declaration

    Swift

    open func copy() -> StringMap

    Return Value

    A shallow copy of this map.

  • Declaration

    Swift

    override open func copyMutable() -> DataValue

    Return Value

    A clone of this value if it (together with all value subcomponents) is possibly mutable, or return self value if it (together with all value subcomponents) is definitely immutable. The resulting value might share mutable metadata with this query.

  • Declaration

    Swift

    open func entries() -> StringMap.EntryList

    Return Value

    A list of the entries (key/value pairs) in this map.

  • Invert this map of keys to values to another map of values to keys.

    Declaration

    Swift

    open func inverse() -> StringMap

    Return Value

    New inverted map.

  • Declaration

    Swift

    open func keys() -> StringList

    Return Value

    A list of the entry keys in this map.

  • Merge all the entries of from to this map, replacing any entry for which the key already exists in this map.

    Declaration

    Swift

    open func merge(contentsOf from: StringMap)

    Parameters

    from

    Map of entries to be added.

  • Remove the entry with the specified key (if found).

    Declaration

    Swift

    open func removeValue(forKey key: String) -> Bool

    Parameters

    key

    Entry key.

    Return Value

    true if an entry with the specified key was found (and deleted).

  • Throws

    MissingEntryException (fatal) if no entry is found for the specified key.

    Declaration

    Swift

    open func requiredValue(forKey key: String) -> String

    Parameters

    key

    Entry key.

    Return Value

    The value from the entry with the specified key (if found).

  • Declaration

    Swift

    open func sortedEntries() -> StringMap.EntryList

    Return Value

    A sorted list of the entries in this map, using the ordering of this.keys().

  • Declaration

    Swift

    open func sortedKeys() -> StringList

    Return Value

    A sorted list of the keys in this map.

  • Declaration

    Swift

    open func sortedValues() -> StringList

    Return Value

    A sorted list of the values in this map.

  • The underlying untyped map of objects. Use with care, avoiding the addition of objects with an incorrect item type.

    Declaration

    Swift

    override open var untypedMap: UntypedMap { get }
  • Add or replace an entry with the specified key and value.

    Declaration

    Swift

    open func updateValue(_ value: String, forKey key: String)

    Parameters

    value

    Entry value.

    key

    Entry key.

  • Declaration

    Swift

    open func value(forKey key: String) -> String?

    Parameters

    key

    Entry key.

    Return Value

    The value from the entry with the specified key (if found), otherwise nil.

  • Declaration

    Swift

    open func values() -> StringList

    Return Value

    A list of the entry values in this map.

  • A key/value pair for map entries.

    See more

    Declaration

    Swift

    open class Entry : ObjectBase
  • A list of item type StringMap$Entry.

    See more

    Declaration

    Swift

    open class EntryList : ListBase, Sequence