Reputation: 325
Let's say I have 14 booleans:
Boolean pressAnimationGroup[] = { pressAnimation1,
pressAnimation2, pressAnimation3, pressAnimation4,
pressAnimation5, pressAnimation6, pressAnimation7,
pressAnimation8, pressAnimation9, pressAnimation10,
pressAnimation11, pressAnimation12, pressAnimation13,
pressAnimation14 };
Can I set, let's say the true
value to all of them without assigning to each one of them the true
value?
Something like this:
for (Boolean groupPress : pressAnimationGroup) {
// Assign to groupPress the true value
}
Upvotes: 0
Views: 42
Reputation: 14408
Use Arrays.fill
which fills the specified array with the specified element.
Arrays.fill(pressAnimationGroup, true);
Upvotes: 0
Reputation: 5176
If you wanna fill true
then you can use what Giru Bhai has suggested.
In case you are using false
then do nothing since boolean
is by default false
in java.
Upvotes: 1