Hello,
How do I know when to use Java special class e and when to use alias(reference variable) of an object's instance in lambda expression?
On page 4 of the slides for lesson 4-2, where Java special class e is used in lambda expression. Here it's clearly referring to the direction of the blade is going. Why is that alias b of the object blade is not being used?
blade.setOnMousePressed
(e -> setDirection (Dir.NE ));
On page 9 of the slides for lesson 4-2, where alias b of BumperList is used in lambda expression. Obtaining the shape of the objects stored in the BumperList is an event. Why is that Java special class e isn't being used here?
BumperList.stream()
.filter
(b -> b.getShape() == shape.STAR)
.forEach
(b -> b.setShape(Shape.RECT) );
Thanks in advance,
Carol