From b128f56a6c2df6464a73928826a84905db39fa4e Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 23 Jan 2020 23:43:48 +0100 Subject: [PATCH] BAEL-3781: Fix Slope One implementation (#8570) --- .../main/java/com/baeldung/algorithms/slope_one/SlopeOne.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java index d5eea279de..bfcafdaef2 100644 --- a/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java +++ b/algorithms-miscellaneous-2/src/main/java/com/baeldung/algorithms/slope_one/SlopeOne.java @@ -98,7 +98,7 @@ public class SlopeOne { for (Item j : InputData.items) { if (e.getValue().containsKey(j)) { clean.put(j, e.getValue().get(j)); - } else { + } else if (!clean.containsKey(j)) { clean.put(j, -1.0); } }