Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Java special class "e" vs alias/reference variable

3462211May 22 2017 — edited May 25 2017

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

Comments

Post Details

Added on May 22 2017
5 comments
274 views