private T removeInternal(final int group, final int index) {
        final T result = this.list.remove(index);

        final Map.Entry<Integer, Integer> groupEntry = this.groupToStart.higherEntry(group);
        if (index >= size() || (groupEntry != null && groupEntry.getValue() == index + 1)) {
            this.startToGroup.remove(index);
            this.groupToStart.remove(group);
        }
        modifyUpperIndex(group, -1);
        return result;
    }
returns the list index for the first object found in given group and fulfilling given test, or -1 if there's no such object
main/src/main/java/cgeo/geocaching/utils/GroupedList.java