This hurts my eyes, it doesn't look like Java, what would this look like in Java:
int sum = widgets.stream()
.filter(b -> b.getColor() == RED)
.mapToInt(b -> b.getWeight())
.sum();