I have this code. Here the map is Map<Data, Boolean>
int mask = 0;
for (Map.Entry<Data, Boolean> entry : map.entrySet()) {
if (entry.getKey().getValue() > 0 && entry.getValue()) {
mask = mask | (1 << (entry.getKey().getValue() - 1));
}
}
I want to calculate mask using Java stream. Here I tried to but only get then filter list. Don't know how calculate the mask here.
Integer mask = map.entrySet().filter( entry -> entry.getKey().getValue() > 0 && entry.getValue()).?