@Override public Collection<Attribute> attributes(AttributeFilter filter) { Collection<Attribute> filtered = new ArrayList<Attribute>(attributes().size() / 2); for (Attribute attr : attributes()) { if (filter.accepts(attr)) { filtered.add(attr); } } return filtered; }
private static Map<String, Collection<FileObject>> createReversedMap( Map<FileObject, Collection<String>> file2elements) { Map<String, Collection<FileObject>> map = new HashMap<String, Collection<FileObject>>(); for (FileObject file : file2elements.keySet()) { for (String element : file2elements.get(file)) { Collection<FileObject> files = map.get(element); if (files == null) { files = new HashSet<FileObject>(); } files.add(file); map.put(element, files); } } return map; }