Source:
private Map<String, Set<String>> loadContigAliasesMap() throws PicardException { if (this.ALT_NAMES == null) { return Collections.emptyMap(); } final Map<String, Set<String>> aliasesByContig = new HashMap<>(); try { for (final String line : IOUtil.slurpLines(this.ALT_NAMES)) { if (StringUtil.isBlank(line)) { continue; } final int tab = line.indexOf('\t'); if (tab == -1) { throw new IOException("tabulation missing in " + line); } final String contigName = line.substring(0, tab); final String altName = line.substring(tab + 1); if (StringUtil.isBlank(contigName)) { throw new IOException("empty contig in " + line); } if (StringUtil.isBlank(altName)) { throw new IOException("empty alternative name in " + line); } if (altName.equals(contigName)) { continue; } if (!ALTERNATIVE_CONTIG_NAME_PATTERN.matcher(altName).matches()) { throw new IOException("alternative name in " + line + " doesn't match the regular expression : " + ALTERNATIVE_CONTIG_NAME_PATTERN.pattern()); } if (aliasesByContig.containsKey(altName)) { throw new IOException("alternate name " + altName + " previously defined as a contig in " + line); } if (aliasesByContig.keySet().stream(). filter(K -> !K.equals(contigName)). anyMatch(K -> aliasesByContig.get(K).contains(contigName))) { throw new IOException("contig " + contigName + " previously defined as an alternate name in " + line); } if (!aliasesByContig.containsKey(contigName)) { aliasesByContig.put(contigName, new HashSet<>()); } aliasesByContig.get(contigName).add(altName); } return aliasesByContig; } catch (final IOException e) { throw new PicardException("Can't read alias file " + ALT_NAMES, e); } }

Target:
private Map<String, Set<String>> loadContigAliasesMap() throws PicardException { if (this.ALT_NAMES == null) { return Collections.emptyMap(); } final Map<String, Set<String>> aliasesByContig = new HashMap<>(); try { for (final String line : IOUtil.slurpLines(this.ALT_NAMES)) { if (StringUtil.isBlank(line)) { continue; } final int tab = line.indexOf('\t'); if (tab == -1) { throw new IOException("tabulation missing in " + line); } final String contigName = line.substring(0, tab); final String altName = line.substring(tab + 1); if (StringUtil.isBlank(contigName)) { throw new IOException("empty contig in " + line); } if (StringUtil.isBlank(altName)) { throw new IOException("empty alternative name in " + line); } if (altName.equals(contigName)) { continue; } try { SAMSequenceRecord.validateSequenceName(altName); } catch (final SAMException exception) { throw new IOException("Illegal alternative reference sequence name in " + line, exception); } if (aliasesByContig.containsKey(altName)) { throw new IOException("alternate name " + altName + " previously defined as a contig in " + line); } if (aliasesByContig.keySet().stream() .filter(K -> !K.equals(contigName)) .anyMatch(K -> aliasesByContig.get(K).contains(contigName))) { throw new IOException("contig " + contigName + " previously defined as an alternate name in " + line); } if (!aliasesByContig.containsKey(contigName)) { aliasesByContig.put(contigName, new HashSet<>()); } aliasesByContig.get(contigName).add(altName); } return aliasesByContig; } catch (final IOException e) { throw new PicardException("Can't read alias file " + ALT_NAMES, e); } }