private List<GenotypeClass> getGenotypeClasses(Set<String> genotypesSet) { List<GenotypeClass> genotypeClasses = new ArrayList<>(); Iterator<String> iterator = genotypesSet.iterator(); while (iterator.hasNext()) { String genotype = iterator.next(); GenotypeClass genotypeClass = GenotypeClass.from(genotype); if (genotypeClass != null) { genotypeClasses.add(genotypeClass); iterator.remove(); } } return genotypeClasses; } }
public static List<String> filter(List<String> gts, List<String> loadedGts, List<String> defaultGts) { Set<String> filteredGts = new HashSet<>(gts.size()); for (String gt : gts) { GenotypeClass genotypeClass = GenotypeClass.from(gt); if (genotypeClass == null) { filteredGts.add(gt); } else { filteredGts.addAll(genotypeClass.filter(loadedGts)); filteredGts.addAll(genotypeClass.filter(defaultGts)); } } return new ArrayList<>(filteredGts); }