PrevNextDifferenceIterable (boolean fromUpdate) { if (myCurrentChange == null) return null; List<? extends Wrapper> selectedChanges = toListIfNotMany(iterateSelectedChanges(), fromUpdate); if (selectedChanges == null) return DumbPrevNextDifferenceIterable.INSTANCE; if (selectedChanges.size() > 1) { return new ChangesNavigatable(selectedChanges, selectedChanges.get(0), false); } if (selectedChanges.isEmpty() && !showAllChangesForEmptySelection()) { return null; } List<? extends Wrapper> allChanges = toListIfNotMany(iterateAllChanges(), fromUpdate); if (allChanges == null) return DumbPrevNextDifferenceIterable.INSTANCE; if (allChanges.isEmpty()) return null; Wrapper selection = selectedChanges.isEmpty() ? allChanges.get(0) : selectedChanges.get(0); return new ChangesNavigatable(allChanges, selection, true); }