private void insertIntoIndex(String lookupKey, DiscoverabilityDto discoverabilityDto) {
        discoverabilityIndex.compute(
                lookupKey,
                (k, existingVal) -> {
                    if (existingVal == null) {
                        // If no existing entry, then just set this new entry.
                        return discoverabilityDto;
                    } else {
                        // Otherwise, keep the *most visible* discoverability entry
                        // For example, if existing entry is ORG_MEMBERS and new entry is PORTAL, then PORTAL entry will supplant existing entry.
                        int compare = existingVal.getDiscoverability().compareTo(discoverabilityDto.getDiscoverability());
                        if (compare > 0) {
                            return discoverabilityDto;
                        } else {
                            return existingVal;
                        }
                    }
                }
        );
    }
Add some DiscoverabilityDtos to the index

@param discoverabilityEntities views to index
manager/api/security/src/main/java/io/apiman/manager/api/security/impl/IndexedDiscoverabilities.java