Package com.google.android.exoplayer2.source

## Class TrackGroupArray

- java.lang.Object
- - com.google.android.exoplayer2.source.TrackGroupArray

- All Implemented Interfaces:
    `Parcelable`

      public final class TrackGroupArray
      extends Object
      implements Parcelable

  An immutable array of `TrackGroup`s.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface android.os.Parcelable

      `Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Parcelable.Creator<TrackGroupArray>` | `CREATOR` |
    `static TrackGroupArray` | `EMPTY` | The empty array.
    `int` | `length` | The number of groups in the array.

    - ### Fields inherited from interface android.os.Parcelable

      `CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TrackGroupArray​(TrackGroup... trackGroups)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `describeContents()` |
    `boolean` | `equals​(Object obj)` |
    `TrackGroup` | `get​(int index)` | Returns the group at a given index.
    `int` | `hashCode()` |
    `int` | `indexOf​(TrackGroup group)` | Returns the index of a group within the array.
    `boolean` | `isEmpty()` | Returns whether this track group array is empty.
    `void` | `writeToParcel​(Parcel dest, int flags)` |

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

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

- - ### Field Detail

    - #### EMPTY

          public static final TrackGroupArray EMPTY

      The empty array.

    - #### length

          public final int length

      The number of groups in the array. Greater than or equal to zero.

    - #### CREATOR

          public static final Parcelable.Creator<TrackGroupArray> CREATOR

  - ### Constructor Detail

    - #### TrackGroupArray

          public TrackGroupArray​(TrackGroup... trackGroups)

      Parameters:
        `trackGroups` - The groups. May be empty.

  - ### Method Detail

    - #### get

          public TrackGroup get​(int index)

      Returns the group at a given index.
      Parameters:
        `index` - The index of the group.
      Returns:
        The group.

    - #### indexOf

          public int indexOf​(TrackGroup group)

      Returns the index of a group within the array.
      Parameters:
        `group` - The group.
      Returns:
        The index of the group, or `C.INDEX_UNSET` if no such group exists.

    - #### isEmpty

          public boolean isEmpty()

      Returns whether this track group array is empty.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals​(@Nullable
                                Object obj)

      Overrides:
        `equals` in class `Object`

    - #### describeContents

          public int describeContents()

      Specified by:
        `describeContents` in interface `Parcelable`

    - #### writeToParcel

          public void writeToParcel​(Parcel dest,
                                    int flags)

      Specified by:
        `writeToParcel` in interface `Parcelable`