org.eclipse.mat.inspections.collectionextract

## Interface ICollectionExtractor

All Known Subinterfaces:
  IMapExtractor

All Known Implementing Classes:
  ArrayCollectionExtractor, ConcurrentHashMapCollectionExtractor, ConcurrentSkipListCollectionExtractor, ConcurrentSkipListSetCollectionExtractor, EmptyCollectionExtractor, EmptyMapExtractor, FieldArrayCollectionExtractor, FieldSizeArrayCollectionExtractor, FieldSizedCollectionExtractor, HashedMapCollectionExtractorBase, HashMapCollectionExtractor, HashSetCollectionExtractor, IBM6ArrayListCollectionExtractor, IdentityHashMapCollectionExtractor, KeySetCollectionExtractor, LinkedListCollectionExtractor, MapCollectionExtractorBase, NoContentCollectionExtractor, PairCollectionExtractor, ReplicatedValueCollectionExtractor, SingletonCollectionExtractor, SingletonMapExtractor, TreeMapArrayCollectionExtractor, TreeMapCollectionExtractor, TreeSetArrayCollectionExtractor, TreeSetCollectionExtractor, ValuesCollectionExtractor, WrapperCollectionExtractor, WrapperMapExtractor

    public interface ICollectionExtractor

CollectionExtractors are used to extract from the heap dump the contents of an object which represents a collection of a certain type. It knows the internal details of how the collection contents are stored and if the collection has certain properties or not

Since:
  1.5

### Method Summary

All Methods Instance Methods Abstract Methods
`IObjectArray` `extractEntries(IObject collection)` Extracts the array containing the collection content
`int[]` `extractEntryIds(IObject collection)` Returns the object ids (int) for all objects which are contained in the collection
`Integer` `getCapacity(IObject collection)` Return the capacity of the collection, if applicable
`Double` `getFillRatio(IObject collection)` Calculate the fill ration of a collection
`Integer` `getNumberOfNotNullElements(IObject collection)` Returns the number of non-null elements in the collection.
`Integer` `getSize(IObject collection)` Extract the size of the collection
`boolean` `hasCapacity()` Check if the collection has capacity, e.g.
`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
`boolean` `hasFillRatio()` Check if fill ratio for the collection can be calculated, i.e.
`boolean` `hasSize()` Check if the size of the collection can be extracted

### Method Detail

#### hasSize

    boolean hasSize()

Check if the size of the collection can be extracted

Returns:

#### getSize

    Integer getSize(IObject collection)
             throws SnapshotException

Extract the size of the collection

Parameters:
  `collection` -
Returns:
Throws:
  `SnapshotException`

#### hasCapacity

    boolean hasCapacity()

Check if the collection has capacity, e.g. ArrayList

Returns:

#### getCapacity

    Integer getCapacity(IObject collection)
                 throws SnapshotException

Return the capacity of the collection, if applicable

Parameters:
  `collection` -
Returns:
Throws:
  `SnapshotException`

#### hasFillRatio

    boolean hasFillRatio()

Check if fill ratio for the collection can be calculated, i.e. if it has some predefined capacity and actual size

Returns:

#### getFillRatio

    Double getFillRatio(IObject collection)
                 throws SnapshotException

Calculate the fill ration of a collection

Parameters:
  `collection` -
Returns:
Throws:
  `SnapshotException`

#### hasExtractableContents

    boolean hasExtractableContents()

Check if the collection has extractable contents

Returns:

#### extractEntryIds

    int[] extractEntryIds(IObject collection)
                   throws SnapshotException

Returns the object ids (int) for all objects which are contained in the collection

Parameters:
  `collection` -
Returns:
Throws:
  `SnapshotException`

#### hasExtractableArray

    boolean hasExtractableArray()

Return true if the collection array based and the array can be extracted from the heap dump

Returns:

#### extractEntries

    IObjectArray extractEntries(IObject collection)
                         throws SnapshotException

Extracts the array containing the collection content

Parameters:
  `collection` -
Returns:
Throws:
  `SnapshotException`

#### getNumberOfNotNullElements

    Integer getNumberOfNotNullElements(IObject collection)
                                throws SnapshotException

Returns the number of non-null elements in the collection. Requires hasExtractableContents or hasExtractableArray

Parameters:
  `collection` -
Returns:
Throws:
  `SnapshotException`