# FlagSet

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/FlagSet.java+class:androidx.media3.common.FlagSet)

*** ** * ** ***


```
@UnstableApi
public final class FlagSet
```

<br />

*** ** * ** ***

A set of integer flags.

Intended for usages where the number of flags may exceed 32 and can no longer be represented by an IntDef.

Instances are immutable.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/common/FlagSet.Builder` A builder for `https://developer.android.com/reference/androidx/media3/common/FlagSet` instances. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/FlagSet#contains(int)(int flag)` Returns whether the set contains the given flag. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/FlagSet#containsAny(int...)(int[] flags)` Returns whether the set contains at least one of the given flags. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/FlagSet#containsAny(androidx.media3.common.FlagSet)(https://developer.android.com/reference/androidx/media3/common/FlagSet other)` Returns whether this FlagSet contains at least one of the flags in the other Flagset. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/FlagSet#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html o)` |
| `int` | `https://developer.android.com/reference/androidx/media3/common/FlagSet#get(int)(int index)` Returns the flag at the given index. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/FlagSet#hashCode()()` |
| `int` | `https://developer.android.com/reference/androidx/media3/common/FlagSet#size()()` Returns the number of flags in this set. |

## Public methods

### contains

```
public boolean contains(int flag)
```

Returns whether the set contains the given flag.

| Parameters |
|---|---|
| `int flag` | The flag. |

| Returns |
|---|---|
| `boolean` | Whether the set contains the flag. |

### containsAny

```
public boolean containsAny(int[] flags)
```

Returns whether the set contains at least one of the given flags.

| Parameters |
|---|---|
| `int[] flags` | The flags. |

| Returns |
|---|---|
| `boolean` | Whether the set contains at least one of the flags. |

### containsAny

```
public boolean containsAny(FlagSet other)
```

Returns whether this FlagSet contains at least one of the flags in the other Flagset.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/FlagSet other` | The flag. |

| Returns |
|---|---|
| `boolean` | Whether the set contains the flag. |

### equals

```
public boolean equals(@Nullable Object o)
```

### get

```
public int get(int index)
```

Returns the flag at the given index.

| Parameters |
|---|---|
| `int index` | The index. Must be between 0 (inclusive) and `https://developer.android.com/reference/androidx/media3/common/FlagSet#size()` (exclusive). |

| Returns |
|---|---|
| `int` | The flag at the given index. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IndexOutOfBoundsException.html` | If index is outside the allowed range. |

### hashCode

```
public int hashCode()
```

### size

```
public int size()
```

Returns the number of flags in this set.