Skip to content

Command Pattern, Diner with Lambda, Exception java.lang.NullPointerException #40

Description

@sashkov

We get the exception because in file
src/headfirst/designpatterns/command/dinerLambda/Customer.java
on line 12 we make just declaration of Lambda-object as a local variable, and not save the Lambda-object in instance variable "o":

public void createOrder() {
	Order o = () -> { cook.makeBurger(); cook.makeFries(); };
}

Therefore we have null-object in file
src/headfirst/designpatterns/command/dinerLambda/Waitress.java
on line 8:
order.orderUp();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions