code: private void maybeIndexResource(String relPath, URL delegate) {
  
          if (!index.containsKey(relPath)) {
              index.put(relPath, delegate);
              if (relPath.endsWith(File.separator)) {
                  maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate);
              }
          }
      }
docs: Callers may request the directory itself as a resource, and may
  do so with or without trailing slashes.  We do this in a while-loop
  in case the classpath element has multiple superfluous trailing slashes.
  @param relPath relative path
  @param delegate value to insert