fork(1) download
  1. import java.util.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args) {
  5. ArrayList<String> houses = new ArrayList<String>();
  6. houses.add("casa 1");
  7. houses.add("casa 2");
  8. houses.add("casa 1");
  9. houses.add("casa 3");
  10. ArrayList<String> aux = new ArrayList<String>();
  11. for (String item : houses) {
  12. if (!aux.contains(item)) {
  13. aux.add(item);
  14. }
  15. }
  16. houses = aux;
  17. for (String item : houses) {
  18. System.out.println(item);
  19. }
  20. }
  21. }
Success #stdin #stdout 0.09s 320576KB
stdin
Standard input is empty
stdout
casa 1
casa 2
casa 3