From 23ee2df79e36362ea7aced96489afbaccb3158e9 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 8 Feb 2021 22:48:54 +0100 Subject: [PATCH] JAVA-4395: Fix typo in addTagsOfOtherProduct method --- .../src/main/java/com/baeldung/map/Product.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/Product.java b/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/Product.java index 5559895730..09b1a8847d 100644 --- a/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/Product.java +++ b/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/Product.java @@ -26,7 +26,7 @@ public class Product { return tags; } - public Product addTagsOfOtherProdcut(Product product) { + public Product addTagsOfOtherProduct(Product product) { this.tags.addAll(product.getTags()); return this; } @@ -100,11 +100,11 @@ public class Product { HashMap productsByName = new HashMap<>(); Product eBike2 = new Product("E-Bike", "A bike with a battery"); eBike2.getTags().add("sport"); - productsByName.merge("E-Bike", eBike2, Product::addTagsOfOtherProdcut); + productsByName.merge("E-Bike", eBike2, Product::addTagsOfOtherProduct); //Prior to Java 8: if(productsByName.containsKey("E-Bike")) { - productsByName.get("E-Bike").addTagsOfOtherProdcut(eBike2); + productsByName.get("E-Bike").addTagsOfOtherProduct(eBike2); } else { productsByName.put("E-Bike", eBike2); } @@ -117,7 +117,7 @@ public class Product { productsByName.compute("E-Bike", (k,v) -> { if(v != null) { - return v.addTagsOfOtherProdcut(eBike2); + return v.addTagsOfOtherProduct(eBike2); } else { return eBike2; } @@ -125,7 +125,7 @@ public class Product { //Prior to Java 8: if(productsByName.containsKey("E-Bike")) { - productsByName.get("E-Bike").addTagsOfOtherProdcut(eBike2); + productsByName.get("E-Bike").addTagsOfOtherProduct(eBike2); } else { productsByName.put("E-Bike", eBike2); }