List<RevisionItem> (@NotNull List<? extends Revision> revs) { LinkedList<RevisionItem> result = new LinkedList<>(); for (Revision each : ContainerUtil.iterateBackward(revs)) { if (each.isLabel() && !result.isEmpty()) { result.getFirst().labels.addFirst(each); } else { result.addFirst(new RevisionItem(each)); } } return result; }