private List<Change> filterOutBinary(List<Change> paths) { List<Change> result = null; for (Iterator<Change> iterator = paths.iterator(); iterator.hasNext(); ) { final Change change = iterator.next(); if (ChangesUtil.isBinaryChange(change)) { result = (result == null ? new SmartList<Change>() : result); result.add(change); iterator.remove(); } } return result; }
private static List<TextFilePatch> loadTextPatches( final Project project, final ShelvedChangeList changeList, final List<ShelvedChange> changes, final List<FilePatch> remainingPatches, final CommitContext commitContext) throws IOException, PatchSyntaxException { final List<TextFilePatch> textFilePatches; textFilePatches = loadPatches(project, changeList.PATH, commitContext); if (changes != null) { final Iterator<TextFilePatch> iterator = textFilePatches.iterator(); while (iterator.hasNext()) { TextFilePatch patch = iterator.next(); if (!needUnshelve(patch, changes)) { remainingPatches.add(patch); iterator.remove(); } } } return textFilePatches; }