From 03e1e92b528de1ff7e590a7791a87e6c3d6fd218 Mon Sep 17 00:00:00 2001 From: GVSharma Date: Sat, 26 Oct 2019 21:17:43 +0530 Subject: [PATCH] local variable type inference changes (#1041) 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 e9cc60118..8776b5ebc 100644 --- a/template-method/src/main/java/com/iluwatar/templatemethod/App.java +++ b/template-method/src/main/java/com/iluwatar/templatemethod/App.java @@ -40,7 +40,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 02c91821d..6ac898bca 100644 --- a/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java +++ b/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java @@ -45,7 +45,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);