We can group each Melon from the aforementioned list that's 100 g via the static method called growing100g():
- No method reference:
melons.forEach(m -> Melon.growing100g(m));
- Method reference:
melons.forEach(Melon::growing100g);
We can group each Melon from the aforementioned list that's 100 g via the static method called growing100g():
melons.forEach(m -> Melon.growing100g(m));
melons.forEach(Melon::growing100g);