}
return keep;
}
public <T> Collection<T> sort(Collection<T> extensions) {
DirectAcyclicGraph dag = new DirectAcyclicGraph();
for (T extension : extensions) {
dag.add(extension);
for (Object dependency : getDependencies(extension)) {
dag.add(extension, dependency);
}
for (Object generates : getDependents(extension)) {
dag.add(generates, extension);
}
completePhaseDependencies(dag, extension);
}
List sortedList = dag.sort();
return Collections2.filter(sortedList, Predicates.in(extensions));
}