int (Class<?> contributorClass) { int index = -1; List<ServiceViewContributor<?>> contributors = CONTRIBUTOR_EP_NAME.getExtensionList(); List<ServiceViewContributor<?>> existingContributors = ContainerUtil.map(myRoots, ServiceViewItem::getContributor); for (int i = contributors.size() - 1; i >= 0; i--) { ServiceViewContributor<?> contributor = contributors.get(i); if (!contributorClass.isInstance(contributor)) { index = existingContributors.indexOf(contributor); if (index == 0) { break; } } else { break; } } if (index < 0) { index = myRoots.size(); } return index; }