code: protected List<String> optimizeSourceList(List<String> sourceListInVfs) {
  
          // input should be sorted but may be immutable
          List<String> input = new ArrayList<String>(sourceListInVfs);
          Collections.sort(input);
  
          List<String> result = new ArrayList<String>();
          Iterator<String> i = input.iterator();
          while (i.hasNext()) {
              // check all sources in the list
              String sourceInVfs = i.next();
              if (CmsStringUtil.isEmpty(sourceInVfs)) {
                  // skip empty strings
                  continue;
              }
              boolean found = false;
              for (int j = (result.size() - 1); j >= 0; j--) {
                  // check if this source is indirectly contained because a parent folder is contained
                  String check = result.get(j);
                  if (sourceInVfs.startsWith(check)) {
                      found = true;
                      break;
                  }
              }
              if (!found) {
                  // the source is not already contained in the result
                  result.add(sourceInVfs);
              }
          }
  
          return result;
      }
docs: Optimizes the list of VFS source files by removing all resources that
  have a parent resource already included in the list.<p>
  
  @param sourceListInVfs the list of VFS resources to optimize
  @return the optimized result list