private Iterator getFilteredEntries()

in src/main/java/org/apache/sling/bundleresource/impl/BundleResourceIterator.java [96:127]


    private Iterator<String> getFilteredEntries(final String parentEntryPath) {
        final Set<String> bundleEntries = new TreeSet<>(cache.getEntryPaths(parentEntryPath));
        if (this.mappedPath.getJSONPropertiesExtension() != null) {
            final Set<String> add = new HashSet<>();
            final Iterator<String> iter = bundleEntries.iterator();
            while (iter.hasNext()) {
                final String path = iter.next();
                if (path.endsWith(this.mappedPath.getJSONPropertiesExtension())) {
                    iter.remove();
                    add.add(path.substring(
                            0,
                            path.length()
                                    - this.mappedPath
                                            .getJSONPropertiesExtension()
                                            .length()));
                }
            }
            bundleEntries.addAll(add);
            if (subResources != null) {
                for (final String name : subResources.keySet()) {
                    final String fullPath = parentEntryPath.concat(name);
                    if (!bundleEntries.contains(fullPath)) {
                        bundleEntries.add(fullPath);
                    } else {
                        subResources.remove(name);
                    }
                }
            }
        }

        return (bundleEntries.isEmpty() ? null : bundleEntries.iterator());
    }