From f825aab9d6589ffee58a3e1b61c5e739bd75bcd6 Mon Sep 17 00:00:00 2001 From: Gv Sharma Date: Sat, 26 Oct 2019 12:33:09 +0530 Subject: [PATCH] local variable type inference changes local variable type inference changes for template method design pattern --- .../src/main/java/com/iluwatar/templatemethod/App.java | 2 +- .../main/java/com/iluwatar/templatemethod/StealingMethod.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template-method/src/main/java/com/iluwatar/templatemethod/App.java b/template-method/src/main/java/com/iluwatar/templatemethod/App.java index 66eb9ef91e3e..034f7b5748c9 100644 --- a/template-method/src/main/java/com/iluwatar/templatemethod/App.java +++ b/template-method/src/main/java/com/iluwatar/templatemethod/App.java @@ -39,7 +39,7 @@ public class App { * @param args command line args */ public static void main(String[] args) { - HalflingThief thief = new HalflingThief(new HitAndRunMethod()); + var thief = new HalflingThief(new HitAndRunMethod()); thief.steal(); thief.changeMethod(new SubtleMethod()); thief.steal(); diff --git a/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java b/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java index 0eb450afacfb..4b78f3112583 100644 --- a/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java +++ b/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java @@ -44,7 +44,7 @@ public abstract class StealingMethod { * Steal */ public void steal() { - String target = pickTarget(); + var target = pickTarget(); LOGGER.info("The target has been chosen as {}.", target); confuseTarget(target); stealTheItem(target);