List<ShelvedBinaryFile> (final ShelvedChangeList changeList, final List<ShelvedBinaryFile> binaryFiles, final List<? super ShelvedBinaryFile> remainingBinaries) { if (binaryFiles == null) { return new ArrayList<>(changeList.getBinaryFiles()); } List<ShelvedBinaryFile> result = new ArrayList<>(); for (ShelvedBinaryFile file : changeList.getBinaryFiles()) { if (binaryFiles.contains(file)) { result.add(file); } else { remainingBinaries.add(file); } } return result; }