com.saxonica.functions.map

## Interface MapItem

- All Superinterfaces:
    Callable, FunctionItem, GroundedValue, Item, PullEvent, Sequence
  All Known Implementing Classes:
    ImmutableMap, RangeKey, SingletonMap

      public interface MapItem
      extends FunctionItem, Item

  Interface supported by different implementations of an XDM map item

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Sequence` | `get(AtomicValue key, XPathContext context)` Get an entry from the Map
    `StringCollator` | `getCollation()` Get the collation of the map
    `String` | `getCollationName()` Get the name of the collation of the map
    `AtomicType` | `getKeyType(TypeHierarchy th)` Get the lowest common item type of the keys in the map
    `SequenceType` | `getValueType(TypeHierarchy th)` Get the lowest common sequence type of all the values in the map
    `boolean` | `isEmpty()` Ask whether the map is empty
    `UnfailingIterator<? extends AtomicValue>` | `keys()` Get the set of all key values in the map.
    `MapItem` | `remove(AtomicValue key, XPathContext context)` Remove an entry from the map
    `int` | `size()` Get the size of the map

    - ### Methods inherited from interface net.sf.saxon.om.FunctionItem

      `call, deepEquals, getArity, getFunctionItemType, getFunctionName`

    - ### Methods inherited from interface net.sf.saxon.om.Item

      `getStringValue, getStringValueCS`

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `effectiveBooleanValue, getLength, getStringValue, getStringValueCS, itemAt, reduce, subsequence`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `head, iterate`

- - ### Method Detail

    - #### getCollationName

          String getCollationName()

      Get the name of the collation of the map
      Returns:
        the collation name

    - #### getCollation

          StringCollator getCollation()

      Get the collation of the map
      Returns:
        the collation of the map

    - #### get

          Sequence get(AtomicValue key,
                     XPathContext context)
                       throws XPathException

      Get an entry from the Map
      Parameters:
        `key` - the value of the key
        `context` - the XPath dynamic evaluation context
      Returns:
        the value associated with the given key, or null if the key is not present in the map
      Throws:
        `XPathException` - if a dynamic error occurs

    - #### size

          int size()

      Get the size of the map
      Returns:
        the number of keys/entries present in this map

    - #### isEmpty

          boolean isEmpty()

      Ask whether the map is empty
      Returns:
        true if and only if the size of the map is zero

    - #### keys

          UnfailingIterator<? extends AtomicValue> keys()

      Get the set of all key values in the map.
      Returns:
        a set containing all the key values present in the map.

    - #### remove

          MapItem remove(AtomicValue key,
                       XPathContext context)
                         throws XPathException

      Remove an entry from the map
      Parameters:
        `key` - the key of the entry to be removed
        `context` - the XPath dynamic context
      Returns:
        a new map in which the requested entry has been removed; or this map unchanged if the specified key was not present
      Throws:
        `XPathException` - if a dynamic error occurs

    - #### getKeyType

          AtomicType getKeyType(TypeHierarchy th)

      Get the lowest common item type of the keys in the map
      Parameters:
        `th` - the type hierarchy
      Returns:
        the most specific type to which all the keys belong. If the map is empty, return AnyAtomicType by convention

    - #### getValueType

          SequenceType getValueType(TypeHierarchy th)

      Get the lowest common sequence type of all the values in the map
      Parameters:
        `th` - the type hierarchy
      Returns:
        the most specific sequence type to which all the values belong. If the map is empty, return ANY_SEQUENCE by convention

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.