boolean (final SplitHunk hunk) { final List<BeforeAfter<List<String>>> steps = hunk.getPatchSteps(); if (steps.size() > 1) return false; final BeforeAfter<List<String>> first = steps.get(0); final boolean complementFirst = first.getBefore().isEmpty() || first.getAfter().isEmpty() || first.getBefore().size() == 1 || first.getAfter().size() == 1; if (! complementFirst) return false; final List<String> contextBefore = hunk.getContextBefore(); if (! contextBefore.isEmpty()) { final String firstContext = contextBefore.get(contextBefore.size() - 1); first.getBefore().add(0, firstContext); first.getAfter().add(0, firstContext); contextBefore.remove(contextBefore.size() - 1); return true; } final List<String> contextAfter = hunk.getContextAfter(); if (! contextAfter.isEmpty()) { final String firstContext = contextAfter.get(0); first.getBefore().add(firstContext); first.getAfter().add(firstContext); contextAfter.remove(0); return true; } return false; }