@Test public void generateOutputV2_noMxNumbers() { OutputResultV2 result = FuzzyPhoneNumberHelper.generateOutputV2(mapOf(US_A, UUID_A, US_B, UUID_B), new InputResult(setOf(US_A, US_B), Collections.emptyMap())); assertEquals(2, result.getNumbers().size()); assertEquals(UUID_A, result.getNumbers().get(US_A)); assertEquals(UUID_B, result.getNumbers().get(US_B)); assertTrue(result.getRewrites().isEmpty()); }
static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); } }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }  }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }   }
FuzzyPhoneNumberHelper { static @NonNull OutputResultV2 generateOutputV2(@NonNull Map<String, UUID> registeredNumbers, @NonNull InputResult inputResult) { Map<String, UUID> allNumbers = new HashMap<>(registeredNumbers); Map<String, String> rewrites = new HashMap<>(); for (Map.Entry<String, String> entry : inputResult.getFuzzies().entrySet()) { if (registeredNumbers.containsKey(entry.getKey()) && registeredNumbers.containsKey(entry.getValue())) { if (mxHas1(entry.getKey())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } else { allNumbers.remove(entry.getValue()); } } else if (registeredNumbers.containsKey(entry.getValue())) { rewrites.put(entry.getKey(), entry.getValue()); allNumbers.remove(entry.getKey()); } } return new OutputResultV2(allNumbers, rewrites); }    }