org.eclipse.mat.internal.collectionextract

## Class IdentityHashMapCollectionExtractor

- java.lang.Object
- - org.eclipse.mat.internal.collectionextract.FieldArrayCollectionExtractor
  - - org.eclipse.mat.internal.collectionextract.FieldSizeArrayCollectionExtractor
    - - org.eclipse.mat.internal.collectionextract.IdentityHashMapCollectionExtractor

All Implemented Interfaces:
  ICollectionExtractor, IMapExtractor

    public class IdentityHashMapCollectionExtractor
    extends FieldSizeArrayCollectionExtractor
    implements IMapExtractor

Info for IdentityHashMaps These are stored as key/value pairs in an array

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.mat.inspections.collectionextract.IMapExtractor

`IMapExtractor.EntryObject`

### Constructor Summary

Constructors
Constructor and Description
`IdentityHashMapCollectionExtractor(String sizeField, String arrayField)`

### Method Summary

All Methods Instance Methods Concrete Methods
`int[]` `extractEntryIds(IObject idMap)` Returns the object ids (int) for all objects which are contained in the collection
`Iterator<Map.Entry<IObject,IObject>>` `extractMapEntries(IObject coll)` Extracts the contents of a map (i.e.
`Integer` `getCapacity(IObject collection)` Gets the capacity of the map.
`Double` `getCollisionRatio(IObject coll)` Calculates the collision ratio in the collection
`Double` `getFillRatio(IObject coll)` Calculate the fill ration of a collection
`Integer` `getNumberOfNotNullElements(IObject coll)` Returns the number of non-null elements in the collection.
`Integer` `getSize(IObject coll)` Extract the size of the collection
`boolean` `hasCollisionRatio()` Check if the extractor can calculate collision ratio
`boolean` `hasExtractableArray()` Return true if the collection array based and the array can be extracted from the heap dump
`boolean` `hasExtractableContents()` Check if the collection has extractable contents

### Methods inherited from class org.eclipse.mat.internal.collectionextract.FieldSizeArrayCollectionExtractor

`hasSize`

### Methods inherited from class org.eclipse.mat.internal.collectionextract.FieldArrayCollectionExtractor

`extractEntries, hasCapacity, hasFillRatio`

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

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.eclipse.mat.inspections.collectionextract.ICollectionExtractor

`extractEntries, hasCapacity, hasFillRatio, hasSize`

### Constructor Detail

#### IdentityHashMapCollectionExtractor

    public IdentityHashMapCollectionExtractor(String sizeField,
                                              String arrayField)

### Method Detail

#### getCapacity

    public Integer getCapacity(IObject collection)
                        throws SnapshotException

Gets the capacity of the map. Needs two array elements for each entry.

Specified by:
  `getCapacity` in interface `ICollectionExtractor`
Overrides:
  `getCapacity` in class `FieldArrayCollectionExtractor`
Returns:
Throws:
  `SnapshotException`

#### hasExtractableArray

    public boolean hasExtractableArray()

Description copied from interface: `ICollectionExtractor`
Return true if the collection array based and the array can be extracted from the heap dump

Specified by:
  `hasExtractableArray` in interface `ICollectionExtractor`
Overrides:
  `hasExtractableArray` in class `FieldArrayCollectionExtractor`
Returns:

#### hasExtractableContents

    public boolean hasExtractableContents()

Description copied from interface: `ICollectionExtractor`
Check if the collection has extractable contents

Specified by:
  `hasExtractableContents` in interface `ICollectionExtractor`
Overrides:
  `hasExtractableContents` in class `FieldArrayCollectionExtractor`
Returns:

#### getSize

    public Integer getSize(IObject coll)
                    throws SnapshotException

Description copied from interface: `ICollectionExtractor`
Extract the size of the collection

Specified by:
  `getSize` in interface `ICollectionExtractor`
Overrides:
  `getSize` in class `FieldSizeArrayCollectionExtractor`
Returns:
Throws:
  `SnapshotException`

#### extractEntryIds

    public int[] extractEntryIds(IObject idMap)
                          throws SnapshotException

Description copied from interface: `ICollectionExtractor`
Returns the object ids (int) for all objects which are contained in the collection

Specified by:
  `extractEntryIds` in interface `ICollectionExtractor`
Overrides:
  `extractEntryIds` in class `FieldArrayCollectionExtractor`
Returns:
Throws:
  `SnapshotException`

#### hasCollisionRatio

    public boolean hasCollisionRatio()

Description copied from interface: `IMapExtractor`
Check if the extractor can calculate collision ratio

Specified by:
  `hasCollisionRatio` in interface `IMapExtractor`
Returns:

#### getCollisionRatio

    public Double getCollisionRatio(IObject coll)
                             throws SnapshotException

Description copied from interface: `IMapExtractor`
Calculates the collision ratio in the collection

Specified by:
  `getCollisionRatio` in interface `IMapExtractor`
Returns:
  Double number of elements with colliding keys / size
Throws:
  `SnapshotException`

#### getFillRatio

    public Double getFillRatio(IObject coll)
                        throws SnapshotException

Description copied from interface: `ICollectionExtractor`
Calculate the fill ration of a collection

Specified by:
  `getFillRatio` in interface `ICollectionExtractor`
Overrides:
  `getFillRatio` in class `FieldArrayCollectionExtractor`
Returns:
Throws:
  `SnapshotException`

#### getNumberOfNotNullElements

    public Integer getNumberOfNotNullElements(IObject coll)
                                       throws SnapshotException

Description copied from interface: `ICollectionExtractor`
Returns the number of non-null elements in the collection. Requires hasExtractableContents or hasExtractableArray

Specified by:
  `getNumberOfNotNullElements` in interface `ICollectionExtractor`
Overrides:
  `getNumberOfNotNullElements` in class `FieldArrayCollectionExtractor`
Returns:
Throws:
  `SnapshotException`

#### extractMapEntries

    public Iterator<Map.Entry<IObject,IObject>> extractMapEntries(IObject coll)
                                                           throws SnapshotException

Description copied from interface: `IMapExtractor`
Extracts the contents of a map (i.e. an IObject representing a Map) and provides an Iterator over them

Specified by:
  `extractMapEntries` in interface `IMapExtractor`
Parameters:
  `coll` - - the map to extract contents from
Returns:
  an Iterator over the entries. If the original Map had an Entry object, the content of the iterator would usually be EntryObject
Throws:
  `SnapshotException`