package io.ebeaninternal.server.core.bootup;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.TreeSet;
class DistillPackages {
static List<String> distill(Collection<String> packages, Collection<String> mfPackages) {
TreeSet<String> treeSet = new TreeSet<>();
treeSet.addAll(packages);
treeSet.addAll(mfPackages);
List<String> distilled = new ArrayList<>();
for (String pack : treeSet) {
if (notAlreadyContained(distilled, pack)) {
distilled.add(pack);
}
}
return distilled;
}
private static boolean notAlreadyContained(List<String> distilled, String pack) {
for (String aDistilled : distilled) {
if (pack.startsWith(aDistilled)) {
return false;
}
}
return true;
}
}