void insertInList(final List<MethodEntry> list, Comparator<MethodEntry> comparator) { boolean inserted = false; ListIterator li = list.listIterator(); while (li.hasNext() && !inserted) { MethodEntry entry = ((MethodEntry) li.next()); if (comparator.compare(this, entry) < 0) { LOG.debug( "insertInList dependent method: add " + myEnd.toString() + " at index " + (li.nextIndex() - 1)); list.add(li.nextIndex() - 1, this); inserted = true; } } if (!inserted) { list.add(this); } }
@SuppressWarnings("unchecked") @Override public int compare(final ElementNode o1, final ElementNode o2) { return myDelegate.compare((T) o1.getDelegate(), (T) o2.getDelegate()); }
@Override public int compare(VcsRef item1, VcsRef item2) { return myReferenceComparator.compare(item1, item2); }