Fragment (final ChangesBunch loadedBunch, final long earliestRevision, final long oldestRevision, final int desirableSize, final boolean includeYoungest, final boolean includeOldest, final boolean consistent) { boolean consistentWithPrevious = loadedBunch.isConsistentWithPrevious(); boolean consistentWithYounger = consistent; final List<CommittedChangeList> list = loadedBunch.getList(); final List<CommittedChangeList> sublist = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { final CommittedChangeList changeList = list.get(i); if ((! includeOldest) && (changeList.getNumber() == oldestRevision)) { continue; } if (changeList.getNumber() == earliestRevision) { consistentWithYounger = true; } if ((earliestRevision == -1) || (changeList.getNumber() < earliestRevision) || (includeYoungest && (changeList.getNumber() == earliestRevision))) { sublist.add(changeList); } if ((sublist.size() == desirableSize) || (changeList.getNumber() < oldestRevision)) { if (! consistentWithPrevious) { consistentWithPrevious = (i > 0); } break; } } if (! myHadBeenAccessed) { myHadBeenAccessed = (! sublist.isEmpty()); } return (sublist.isEmpty()) ? null : new Fragment(myOrigin, sublist, consistentWithPrevious, consistentWithYounger, loadedBunch); }