Package com.google.android.exoplayer2.util

## Class FlagSet.Builder

- java.lang.Object
- - com.google.android.exoplayer2.util.FlagSet.Builder

- Enclosing class:
    FlagSet

      public static final class FlagSet.Builder
      extends Object

  A builder for `FlagSet` instances.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder()` | Creates a builder.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `FlagSet.Builder` | `add​(int flag)` | Adds a flag.
    `FlagSet.Builder` | `addAll​(int... flags)` | Adds flags.
    `FlagSet.Builder` | `addAll​(FlagSet flags)` | Adds `flags`.
    `FlagSet.Builder` | `addIf​(int flag, boolean condition)` | Adds a flag if the provided condition is true.
    `FlagSet` | `build()` | Builds an `FlagSet` instance.
    `FlagSet.Builder` | `remove​(int flag)` | Removes a flag.
    `FlagSet.Builder` | `removeAll​(int... flags)` | Removes flags.
    `FlagSet.Builder` | `removeIf​(int flag, boolean condition)` | Removes a flag if the provided condition is true.

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

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

- - ### Constructor Detail

    - #### Builder

          public Builder()

      Creates a builder.

  - ### Method Detail

    - #### add

          @CanIgnoreReturnValue
          public FlagSet.Builder add​(int flag)

      Adds a flag.
      Parameters:
        `flag` - A flag.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### addIf

          @CanIgnoreReturnValue
          public FlagSet.Builder addIf​(int flag,
                                       boolean condition)

      Adds a flag if the provided condition is true. Does nothing otherwise.
      Parameters:
        `flag` - A flag.
        `condition` - A condition.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### addAll

          @CanIgnoreReturnValue
          public FlagSet.Builder addAll​(int... flags)

      Adds flags.
      Parameters:
        `flags` - The flags to add.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### addAll

          @CanIgnoreReturnValue
          public FlagSet.Builder addAll​(FlagSet flags)

      Adds `flags`.
      Parameters:
        `flags` - The set of flags to add.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### remove

          @CanIgnoreReturnValue
          public FlagSet.Builder remove​(int flag)

      Removes a flag.
      Parameters:
        `flag` - A flag.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### removeIf

          @CanIgnoreReturnValue
          public FlagSet.Builder removeIf​(int flag,
                                          boolean condition)

      Removes a flag if the provided condition is true. Does nothing otherwise.
      Parameters:
        `flag` - A flag.
        `condition` - A condition.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### removeAll

          @CanIgnoreReturnValue
          public FlagSet.Builder removeAll​(int... flags)

      Removes flags.
      Parameters:
        `flags` - The flags to remove.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### build

          public FlagSet build()

      Builds an `FlagSet` instance.
      Throws:
        `IllegalStateException` - If this method has already been called.