## net.sf.saxon.expr.sort
Class IntToIntArrayMap

    java.lang.Object
      net.sf.saxon.expr.sort.IntToIntArrayMap

All Implemented Interfaces:
  Serializable, IntToIntMap

    public class IntToIntArrayMap

extends Object
implements IntToIntMap, Serializable

An implementation of `IntToIntMap` that relies on serial searching, and is therefore optimized for very small map sizes

See Also:
  Serialized Form

Constructor Summary
`IntToIntArrayMap()` Create an initial empty map with default space allocation
`IntToIntArrayMap(int capacity)` Create an initial empty map with a specified initial capacity

Method Summary
`void` `clear()` Clear the map.
`boolean` `find(int key)` Finds a key in the map.
`int` `get(int key)` Gets the value for this key.
`int` `getDefaultValue()` Get the default value used to indicate an unused entry
`IntIterator` `keyIterator()` Get an iterator over the integer key values held in the hash map.
`void` `put(int key, int value)` Adds a key-value pair to the map.
`boolean` `remove(int key)` Removes a key from the map.
`void` `setDefaultValue(int defaultValue)` Set the value to be returned to indicate an unused entry
`int` `size()` Gets the size of the map.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IntToIntArrayMap

    public IntToIntArrayMap()

  Create an initial empty map with default space allocation

### IntToIntArrayMap

    public IntToIntArrayMap(int capacity)

  Create an initial empty map with a specified initial capacity

  Parameters:
    `capacity` - the initial capacity (the number of entries that can be held before more space is allocated)

Method Detail

### clear

    public void clear()

  Clear the map.

  Specified by:
    `clear` in interface `IntToIntMap`

### find

    public boolean find(int key)

  Finds a key in the map.

  Specified by:
    `find` in interface `IntToIntMap`
  Parameters:
    `key` - Key
  Returns:
    true if the key is mapped

### get

    public int get(int key)

  Gets the value for this key.

  Specified by:
    `get` in interface `IntToIntMap`
  Parameters:
    `key` - Key
  Returns:
    the value, or the default value if not found.

### getDefaultValue

    public int getDefaultValue()

  Get the default value used to indicate an unused entry

  Specified by:
    `getDefaultValue` in interface `IntToIntMap`
  Returns:
    the value to be returned by `get(int)` if no entry exists for the supplied key

### keyIterator

    public IntIterator keyIterator()

  Get an iterator over the integer key values held in the hash map.

  The contents of the hash map must not be modified while this iterator remains in use

  Specified by:
    `keyIterator` in interface `IntToIntMap`
  Returns:
    an iterator whose next() call returns the key values (in arbitrary order)

### put

    public void put(int key,
                    int value)

  Adds a key-value pair to the map.

  Specified by:
    `put` in interface `IntToIntMap`
  Parameters:
    `key` - Key
    `value` - Value

### remove

    public boolean remove(int key)

  Removes a key from the map.

  Specified by:
    `remove` in interface `IntToIntMap`
  Parameters:
    `key` - Key to remove
  Returns:
    true if the value was removed

### setDefaultValue

    public void setDefaultValue(int defaultValue)

  Set the value to be returned to indicate an unused entry

  Specified by:
    `setDefaultValue` in interface `IntToIntMap`
  Parameters:
    `defaultValue` - the value to be returned by `get(int)` if no entry exists for the supplied key

### size

    public int size()

  Gets the size of the map.

  Specified by:
    `size` in interface `IntToIntMap`
  Returns:
    the size

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