code: public Map<Layout, Collection<XmlScope>> getXmlScopes() {
          List<File> layoutDirs = layoutsFinder.findLayoutDirs();
  
          Collection<File> layoutFiles = collectionUtils.flatMap(layoutDirs, new CollectionUtils.Function<File, Collection<File>>() {
              @Override
              public Collection<File> apply(File file) {
                  return collectionUtils.filter(Arrays.asList(file.listFiles()), new CollectionUtils.Function<File, Boolean>() {
                      @Override
                      public Boolean apply(File file) {
                          return file.getName().endsWith(".xml");
                      }
                  });
              }
          });
  
          Collection<Document> docs = collectionUtils.flatMapOpt(layoutFiles, new CollectionUtils.Function<File, Option<Document>>() {
              @Override
              public Option<Document> apply(File file) {
                  return getDocumentFromFile(file);
              }
          });
  
          return collectionUtils.toMap(collectionUtils.flatMapOpt(docs, new CollectionUtils.Function<Document, Option<Tuple<Layout, Collection<XmlScope>>>>() {
              @Override
              public Option<Tuple<Layout, Collection<XmlScope>>> apply(Document doc) {
                  Option<String> optNameSpace = namespaceFinder.getNameSpace(doc);
                  if (optNameSpace.isPresent()) {
                      attrPattern = Pattern.compile(String.format(NAMESPACE_ATTRIBUTE_REG, optNameSpace.get()));
                      Collection<XmlScope> scopes = getScopes(doc);
                      return Option.of(Tuple.of(new Layout(doc.getDocumentURI()), scopes));
                  } else {
                      return Option.absent();
                  }
              }
          }));
      }
docs: maps all of the layouts to their scopes, could be optimized
  @return