public Optional<String> getIsoAbbreviation(String text) { Optional<Abbreviation> abbreviation = getAbbreviation(text); if (!abbreviation.isPresent()) { return Optional.absent(); } Abbreviation abbr = abbreviation.get(); return Optional.of(abbr.getIsoAbbreviation()); }
public void addEntry(Abbreviation abbreviation) { checkNotNull(abbreviation); if (isKnownName(abbreviation.getName())) { Abbreviation previous = getAbbreviation(abbreviation.getName()).get(); abbreviations.remove(previous); // TODO logging strategy required System.out.format( "Duplicate Journal Abbreviation - old one will be overwritten by new one%nOLD: %s%nNEW: %s%n", previous, abbreviation); } abbreviations.add(abbreviation); fullNameLowerCase2Abbreviation.put(abbreviation.getName().toLowerCase(), abbreviation); isoLowerCase2Abbreviation.put(abbreviation.getIsoAbbreviation().toLowerCase(), abbreviation); medlineLowerCase2Abbreviation.put( abbreviation.getMedlineAbbreviation().toLowerCase(), abbreviation); }