Source:
public static void trackOpticalDuplicates(List<? extends ReadEnds> ends, final ReadEnds keeper, final OpticalDuplicateFinder opticalDuplicateFinder, final LibraryIdGenerator libraryIdGenerator) { boolean hasFR = false, hasRF = false; for (final ReadEnds end : ends) { if (ReadEnds.FR == end.orientationForOpticalDuplicates) { hasFR = true; } else if (ReadEnds.RF == end.orientationForOpticalDuplicates) { hasRF = true; } } if (hasFR && hasRF) { final List<ReadEnds> trackOpticalDuplicatesF = new ArrayList<>(); final List<ReadEnds> trackOpticalDuplicatesR = new ArrayList<>(); final int nOpoticalDupF; final int nOpoticalDupR; for (final ReadEnds end : ends) { if (ReadEnds.FR == end.orientationForOpticalDuplicates) { trackOpticalDuplicatesF.add(end); } else if (ReadEnds.RF == end.orientationForOpticalDuplicates) { trackOpticalDuplicatesR.add(end); } else { throw new PicardException("Found an unexpected orientation: " + end.orientation); } } nOpoticalDupF = trackOpticalDuplicates(trackOpticalDuplicatesF, keeper, opticalDuplicateFinder, libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap()); nOpoticalDupR = trackOpticalDuplicates(trackOpticalDuplicatesR, keeper, opticalDuplicateFinder, libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap()); trackDuplicateCounts(ends.size(), nOpoticalDupF+nOpoticalDupR, libraryIdGenerator.getDuplicateCountHist(), libraryIdGenerator.getNonOpticalDuplicateCountHist(), libraryIdGenerator.getOpticalDuplicateCountHist()); } else { final int nOpticalDup = trackOpticalDuplicates(ends, keeper, opticalDuplicateFinder, libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap()); trackDuplicateCounts(ends.size(), nOpticalDup, libraryIdGenerator.getDuplicateCountHist(), libraryIdGenerator.getNonOpticalDuplicateCountHist(), libraryIdGenerator.getOpticalDuplicateCountHist()); } }

Target:
public static void trackOpticalDuplicates(List<? extends ReadEnds> ends, final ReadEnds keeper, final OpticalDuplicateFinder opticalDuplicateFinder, final LibraryIdGenerator libraryIdGenerator) { boolean hasFR = false, hasRF = false; for (final ReadEnds end : ends) { if (ReadEnds.FR == end.orientationForOpticalDuplicates) { hasFR = true; } else if (ReadEnds.RF == end.orientationForOpticalDuplicates) { hasRF = true; } } final int nOpticalDup; if (hasFR && hasRF) { final List<ReadEnds> trackOpticalDuplicatesF = new ArrayList<>(); final List<ReadEnds> trackOpticalDuplicatesR = new ArrayList<>(); for (final ReadEnds end : ends) { if (ReadEnds.FR == end.orientationForOpticalDuplicates) { trackOpticalDuplicatesF.add(end); } else if (ReadEnds.RF == end.orientationForOpticalDuplicates) { trackOpticalDuplicatesR.add(end); } else { throw new PicardException("Found an unexpected orientation: " + end.orientation); } } final int nOpticalDupF = trackOpticalDuplicates(trackOpticalDuplicatesF, keeper, opticalDuplicateFinder, libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap()); final int nOpticalDupR = trackOpticalDuplicates(trackOpticalDuplicatesR, keeper, opticalDuplicateFinder, libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap()); nOpticalDup = nOpticalDupF + nOpticalDupR; } else { nOpticalDup = trackOpticalDuplicates(ends, keeper, opticalDuplicateFinder, libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap()); } trackDuplicateCounts(ends.size(), nOpticalDup, libraryIdGenerator); }