private Collection<LookupResult> resolveMostSpecificModelSources(Resource resource, String modelName) {
        Collection<LookupResult> sources = new ArrayList<>();
        for (final String resourceType : mappableTypeHierarchyOf(resource)) {
            Collection<OsgiModelSource<?>> allSourcesForType = this.typeNameToModelSourcesMap.get(resourceType);
            Collection<OsgiModelSource<?>> sourcesWithMatchingModelName = filter(allSourcesForType, modelName);
            if (sourcesWithMatchingModelName != null && !sourcesWithMatchingModelName.isEmpty()) {
                sources.addAll(sourcesWithMatchingModelName.stream().map(source -> new LookupResult(source, resourceType)).collect(Collectors.toList()));
                break;
            }
        }
        return unmodifiableCollection(sources);
    }
private Collection < LookupResult > resolveMostSpecificModelSources ( Resource resource , String modelName ) { Collection < LookupResult > sources = new ArrayList < > ( ) ; for ( final String resourceType : mappableTypeHierarchyOf ( resource ) ) { Collection < OsgiModelSource < ? > > allSourcesForType = this . typeNameToModelSourcesMap . get ( resourceType ) ; Collection < OsgiModelSource < ? > > sourcesWithMatchingModelName = filter ( allSourcesForType , modelName ) ; if ( sourcesWithMatchingModelName != null && ! sourcesWithMatchingModelName . isEmpty ( ) ) { sources . addAll ( sourcesWithMatchingModelName . stream ( ) . map ( source -> new LookupResult ( source , resourceType ) ) . collect ( Collectors . toList ( ) ) ) ; break ; } } return unmodifiableCollection ( sources ) ; }
Finds all {@link OsgiModelSource model sources} representing models for the given
{@link Resource} who's {@link OsgiModelSource#getModelName() model name}
matches the given model name.

@param resource  must not be <code>null</code>.
@param modelName can be <code>null</code>.
@return never <code>null</code> but rather an empty collection.