FlagSet
@UnstableApi
public final class FlagSet
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 FlagSet.BuilderA builder for |
Public methods |
|
|---|---|
boolean |
contains(int flag)Returns whether the set contains the given flag. |
boolean |
containsAny(int[] flags)Returns whether the set contains at least one of the given flags. |
boolean |
containsAny(FlagSet other)Returns whether this FlagSet contains at least one of the flags in the other Flagset. |
boolean |
|
int |
get(int index)Returns the flag at the given index. |
int |
hashCode() |
int |
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 | |
|---|---|
FlagSet other |
The flag. |
| Returns | |
|---|---|
boolean |
Whether the set contains the flag. |
get
public int get(int index)
Returns the flag at the given index.
| Parameters | |
|---|---|
int index |
The index. Must be between 0 (inclusive) and |
| Returns | |
|---|---|
int |
The flag at the given index. |
| Throws | |
|---|---|
java.lang.IndexOutOfBoundsException |
If index is outside the allowed range. |