Skip to content

Commit 1d73f5a

Browse files
committed
JAVA-4395: Fix typo in addTagsOfOtherProduct method
1 parent 730a285 commit 1d73f5a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map

core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/Product.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public List<String> getTags() {
2626
return tags;
2727
}
2828

29-
public Product addTagsOfOtherProdcut(Product product) {
29+
public Product addTagsOfOtherProduct(Product product) {
3030
this.tags.addAll(product.getTags());
3131
return this;
3232
}
@@ -100,11 +100,11 @@ public static void merge() {
100100
HashMap<String, Product> productsByName = new HashMap<>();
101101
Product eBike2 = new Product("E-Bike", "A bike with a battery");
102102
eBike2.getTags().add("sport");
103-
productsByName.merge("E-Bike", eBike2, Product::addTagsOfOtherProdcut);
103+
productsByName.merge("E-Bike", eBike2, Product::addTagsOfOtherProduct);
104104

105105
//Prior to Java 8:
106106
if(productsByName.containsKey("E-Bike")) {
107-
productsByName.get("E-Bike").addTagsOfOtherProdcut(eBike2);
107+
productsByName.get("E-Bike").addTagsOfOtherProduct(eBike2);
108108
} else {
109109
productsByName.put("E-Bike", eBike2);
110110
}
@@ -117,15 +117,15 @@ public static void compute() {
117117

118118
productsByName.compute("E-Bike", (k,v) -> {
119119
if(v != null) {
120-
return v.addTagsOfOtherProdcut(eBike2);
120+
return v.addTagsOfOtherProduct(eBike2);
121121
} else {
122122
return eBike2;
123123
}
124124
});
125125

126126
//Prior to Java 8:
127127
if(productsByName.containsKey("E-Bike")) {
128-
productsByName.get("E-Bike").addTagsOfOtherProdcut(eBike2);
128+
productsByName.get("E-Bike").addTagsOfOtherProduct(eBike2);
129129
} else {
130130
productsByName.put("E-Bike", eBike2);
131131
}

0 commit comments

Comments
 (0)