diff --git a/patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java b/patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java index de25672e67..84136fa48e 100644 --- a/patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java +++ b/patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java @@ -4,11 +4,7 @@ public class ReceivedState implements PackageState { @Override public void next(Package pkg) { - if (pkg.getState() instanceof ReceivedState) { - System.out.println("This package is already received by a client."); - return; - } - pkg.setState(this); + System.out.println("This package is already received by a client."); } @Override