code: public static List<String> removeRedundancies(List<String> resourcenames) {
  
          if ((resourcenames == null) || (resourcenames.isEmpty())) {
              return new ArrayList<String>();
          }
          if (resourcenames.size() == 1) {
              // if there is only one resource name in the list, there can be no redundancies
              return new ArrayList<String>(resourcenames);
          }
          // check all resources names and see if a parent folder name is contained
          List<String> result = new ArrayList<String>(resourcenames.size());
          List<String> base = new ArrayList<String>(resourcenames);
          Collections.sort(base);
          Iterator<String> i = base.iterator();
          while (i.hasNext()) {
              // check all resource names in the list
              String resourcename = i.next();
              if (CmsStringUtil.isEmptyOrWhitespaceOnly(resourcename)) {
                  // skip empty strings
                  continue;
              }
              boolean valid = true;
              for (int j = (result.size() - 1); j >= 0; j--) {
                  // check if this resource name is indirectly contained because a parent folder name is contained
                  String check = result.get(j);
                  if ((CmsResource.isFolder(check) && resourcename.startsWith(check)) || resourcename.equals(check)) {
                      valid = false;
                      break;
                  }
              }
              if (valid) {
                  // a parent folder name is not already contained in the result
                  result.add(resourcename);
              }
          }
          return result;
      }
docs: Removes all resource names in the given List that are "redundant" because the parent folder name
  is also contained in the List.<p>
  
  The content of the input list is not modified.<p>
  
  @param resourcenames a list of VFS pathnames to check for redundencies (Strings)
  
  @return a new list with all redundancies removed
  
  @see #removeRedundantResources(List)