@Test public void simpleLanguageMonodirectional() { LanguageIndex index = new LanguageIndex.Builder() .add(lp("en it")) .build(); assertEquals(lp("en it"), index.map(lp("en it"))); assertEquals(lp("en it"), index.map(lp("en it-IT"))); assertEquals(lp("en it"), index.map(lp("en-US it"))); assertEquals(lp("en it"), index.map(lp("en-US it-IT"))); assertEquals(lp("en it"), index.map(lp("en-US it-IT-x-Custom"))); assertNull(index.map(lp("it en"))); assertNull(index.map(lp("it-IT en"))); assertNull(index.map(lp("it en-US"))); assertNull(index.map(lp("it-IT en-US"))); }
public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } private  LanguageIndex(Map<SimpleLanguageDirection, List<LanguageDirection>> index, Map<String, List<LanguageRule>> rules, Map<LanguageDirection, LanguageBridge> pivots); }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } private  LanguageIndex(Map<SimpleLanguageDirection, List<LanguageDirection>> index, Map<String, List<LanguageRule>> rules, Map<LanguageDirection, LanguageBridge> pivots); Set<LanguageDirection> getLanguages(); int size(); LanguageDirection asSingleLanguagePair(); boolean hasPivotLanguage(LanguageDirection direction); LanguageBridge getLanguageBridge(LanguageDirection direction); LanguageDirection map(LanguageDirection pair); LanguageDirection mapIgnoringDirection(LanguageDirection pair); @Override String toString(); }
LanguageIndex { public LanguageDirection map(LanguageDirection pair) { return mappingCache.computeIfAbsent(pair, this::search); } private  LanguageIndex(Map<SimpleLanguageDirection, List<LanguageDirection>> index, Map<String, List<LanguageRule>> rules, Map<LanguageDirection, LanguageBridge> pivots); Set<LanguageDirection> getLanguages(); int size(); LanguageDirection asSingleLanguagePair(); boolean hasPivotLanguage(LanguageDirection direction); LanguageBridge getLanguageBridge(LanguageDirection direction); LanguageDirection map(LanguageDirection pair); LanguageDirection mapIgnoringDirection(LanguageDirection pair); @Override String toString();  }