loci.formats

## Class MetadataList<T>

- java.lang.Object
- - loci.formats.MetadataList<T>

- Type Parameters:
    `T` - The type of metadata to store.
  Direct Known Subclasses:
    CoreMetadataList

      public class MetadataList<T>
      extends java.lang.Object

  A container of metadata for FormatReader and other reader implementations. The structure is designed to contain data for individual image series', including sub-resolutions. This is implemented internally as a list of lists indexed by series and resolution index. However, it may be used to store any data in a two-level structure. The container may be sized up front at the primary or at both levels. Or either level may be appended to individually. Both patterns are used by many different readers. This class was originally developed to store the CoreMetadata for image series and sub-resolutions. However, it may be used to store any other data, for example reader-specific data including IFD mappings, extended metadata, etc.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<java.util.List<T>>` | `data`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetadataList()`
    `MetadataList(int size1)` Construct a list containing a specified number of primary elements.
    `MetadataList(int[] sizes)` Construct a list containing a specified number of primary and secondary elements.
    `MetadataList(int size1, int size2)` Construct a list containing a specified number of primary elements and a fixed number of secondary elements.
    `MetadataList(MetadataList<T> copy)` Copy a list.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add()` Add a empty primary array element.
    `void` | `add(int size2)` Add a empty primary array element.
    `void` | `add(int i1, T value)` Add a secondary array element to the specified primary array
    `void` | `add(java.util.List<T> values)` Add a new primary element containing the specified values.
    `void` | `add(T value)` Add a new primary element containing a single specified value.
    `void` | `clear()` Clear the array.
    `void` | `clear(int i1)` Clear the specified primary array element.
    `T` | `get(int i1, int i2)` Get the array element for the specified indexes.
    `java.util.List<T>` | `remove(int i1)` Remove the entire primary array element at the specified index.
    `T` | `remove(int i1, int i2)` Remove the array element at the specified indexes.
    `void` | `set(int i1, int i2, T value)` Set the array element for the specified indexes.
    `int` | `size()` Get the size of the array (number of primary array elements).
    `int` | `size(int i1)` Get the size of the specified primary array element (number of secondary array elements).
    `int[]` | `sizes()` Get the sizes of all primary array elements.

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

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

- - ### Field Detail

    - #### data

          protected java.util.List<java.util.List<T>> data

  - ### Constructor Detail

    - #### MetadataList

          public MetadataList()

    - #### MetadataList

          public MetadataList(MetadataList<T> copy)

      Copy a list.

    - #### MetadataList

          public MetadataList(int size1)

      Construct a list containing a specified number of primary elements. This may be used to specify e.g. the number of image series without any sub-resolutions. The sub-resolutions, including the full resolution, must be added afterward.
      Parameters:
        `size1` - The number of primary list elements

    - #### MetadataList

          public MetadataList(int size1,
                              int size2)

      Construct a list containing a specified number of primary elements and a fixed number of secondary elements. This may be used to specify e.g. the number of image series with a fixed number of sub-resolutions.
      Parameters:
        `size1` - The number of primary list elements
        `size2` - The number of secondary level list elements

    - #### MetadataList

          public MetadataList(int[] sizes)

      Construct a list containing a specified number of primary and secondary elements. This may be used to specify e.g. the number of image series including all sub-resolutions.
      Parameters:
        `sizes` - The number of primary and secondary list elements; the array elements are the secondary element sizes.

  - ### Method Detail

    - #### get

          public T get(int i1,
                       int i2)

      Get the array element for the specified indexes.
      Parameters:
        `i1` - The primary array index
        `i2` - The secondary array index
      Returns:
        The element

    - #### set

          public void set(int i1,
                          int i2,
                          T value)

      Set the array element for the specified indexes.
      Parameters:
        `i1` - The primary array index
        `i2` - The secondary array index
        `value` - The element to set

    - #### remove

          public T remove(int i1,
                          int i2)

      Remove the array element at the specified indexes.
      Parameters:
        `i1` - The primary array index
        `i2` - The secondary array index
      Returns:
        the removed element

    - #### remove

          public java.util.List<T> remove(int i1)

      Remove the entire primary array element at the specified index.
      Parameters:
        `i1` - The primary array index
      Returns:
        the removed element

    - #### add

          public void add()

      Add a empty primary array element.

    - #### add

          public void add(int size2)

      Add a empty primary array element. The number of secondary level list elements

    - #### add

          public void add(int i1,
                          T value)

      Add a secondary array element to the specified primary array
      Parameters:
        `i1` - The primary array index
        `value` - The element to set

    - #### add

          public void add(T value)

      Add a new primary element containing a single specified value.
      Parameters:
        `value` - The value to add

    - #### add

          public void add(java.util.List<T> values)

      Add a new primary element containing the specified values.
      Parameters:
        `values` - The values to add

    - #### clear

          public void clear()

      Clear the array.

    - #### clear

          public void clear(int i1)

      Clear the specified primary array element.
      Parameters:
        `i1` - The primary array index

    - #### size

          public int size()

      Get the size of the array (number of primary array elements).
      Returns:
        The size

    - #### size

          public int size(int i1)

      Get the size of the specified primary array element (number of secondary array elements).
      Parameters:
        `i1` - The primary array index
      Returns:
        The size

    - #### sizes

          public int[] sizes()

      Get the sizes of all primary array elements.
      Returns:
        An array containing the size of each primary element

Copyright © 2026 Open Microscopy Environment