Skip to content

Instantly share code, notes, and snippets.

@mateusmaso
Created November 30, 2012 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mateusmaso/4173097 to your computer and use it in GitHub Desktop.
Save mateusmaso/4173097 to your computer and use it in GitHub Desktop.
private static void estadosIniciais(List<Estado> estados) {
HashSet<Estado> set = new HashSet<Estado>();
for (Estado estado : estados) {
List<Estado> conjuto = estado.getEstadosConjunto();
if (conjuto != null && conjuto.size() > 0) {
for (Estado parte : conjuto) {
set.add(parte);
}
} else {
set.add(estado);
}
}
estados.clear();
for (Estado limpo : set) {
estados.add(limpo);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment