Package net.sf.saxon.om

## Class LargeAttributeMap

- java.lang.Object
- - net.sf.saxon.om.LargeAttributeMap

- All Implemented Interfaces:
    `java.lang.Iterable<AttributeInfo>`, `AttributeMap`

      public class LargeAttributeMap
      extends java.lang.Object
      implements AttributeMap

  An implementation of AttributeMap suitable for larger collections of attributes (say, more than five). This provides direct access to an attribute by name, avoiding the cost of a sequential search. The map preserves the order of insertion of attributes: this is done by maintaining a doubly-linked list of attributes in insertion order (when an attribute is replaced by another with the same name, it currently occupies the position of the original; but this is not guaranteed).

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LargeAttributeMap​(java.util.List<AttributeInfo> atts)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.util.List<AttributeInfo>` | `asList()` | Get the contents of the AttributeMap as a list of `AttributeInfo` objects.
    `AttributeInfo` | `get​(java.lang.String uri, java.lang.String local)` | Get the attribute with a given name, if it exists
    `AttributeInfo` | `get​(NodeName name)` | Get the attribute with a given name, if it exists
    `AttributeInfo` | `getByFingerprint​(int fingerprint, NamePool namePool)` |
    `java.util.Iterator<AttributeInfo>` | `iterator()` |
    `AttributeMap` | `put​(AttributeInfo att)` | Replace or add an attribute, to create a new AttributeMap
    `AttributeMap` | `remove​(NodeName name)` | Remove an existing attribute, to create a new AttributeMap
    `int` | `size()` | Return the number of attributes in the map.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

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

      `apply, getValue, itemAt, verify`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### LargeAttributeMap

          public LargeAttributeMap​(java.util.List<AttributeInfo> atts)

  - ### Method Detail

    - #### size

          public int size()

      Return the number of attributes in the map.
      Specified by:
        `size` in interface `AttributeMap`
      Returns:
        The number of attributes in the map.

    - #### get

          public AttributeInfo get​(NodeName name)

      Description copied from interface: `AttributeMap`
      Get the attribute with a given name, if it exists
      Specified by:
        `get` in interface `AttributeMap`
      Parameters:
        `name` - the name of the required attribute
      Returns:
        the required attribute if it exists

    - #### get

          public AttributeInfo get​(java.lang.String uri,
                                   java.lang.String local)

      Description copied from interface: `AttributeMap`
      Get the attribute with a given name, if it exists
      Specified by:
        `get` in interface `AttributeMap`
      Parameters:
        `uri` - the namespace part of the name of the required attribute
        `local` - the local part of the name of the required attribute
      Returns:
        the required attribute if it exists

    - #### getByFingerprint

          public AttributeInfo getByFingerprint​(int fingerprint,
                                                NamePool namePool)

      Specified by:
        `getByFingerprint` in interface `AttributeMap`

    - #### put

          public AttributeMap put​(AttributeInfo att)

      Description copied from interface: `AttributeMap`
      Replace or add an attribute, to create a new AttributeMap
      Specified by:
        `put` in interface `AttributeMap`
      Parameters:
        `att` - the attribute to be added or replaced
      Returns:
        the new AttributeMap

    - #### remove

          public AttributeMap remove​(NodeName name)

      Description copied from interface: `AttributeMap`
      Remove an existing attribute, to create a new AttributeMap
      Specified by:
        `remove` in interface `AttributeMap`
      Parameters:
        `name` - the name of the attribute to be removed (if it exists)
      Returns:
        a new attribute map in which the specified attribute is omitted. If the attribute map contains no attribute with the given name, the input attribute map (or one equivalent to it) is returned unchanged

    - #### iterator

          public java.util.Iterator<AttributeInfo> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<AttributeInfo>`

    - #### asList

          public java.util.List<AttributeInfo> asList()

      Description copied from interface: `AttributeMap`
      Get the contents of the AttributeMap as a list of `AttributeInfo` objects.

      The order of the returned list must be consistent with document order, with the order of the attribute axis, and with position-based retrieval of individual `AttributeInfo` objects; multiple calls are not required to return the same list, but they must be consistent in their ordering.

      Modifying the returned list has no effect on the AttributeMap

      Specified by:
        `asList` in interface `AttributeMap`
      Returns:
        a list of attributes in the AttributeMap

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`