fork(2) download
  1. import java.util.*;
  2. import java.util.stream.Collectors;
  3.  
  4. class Ideone {
  5. public static void main (String[] args) {
  6. ArrayList<Integer> sequencia = new ArrayList<>();
  7. sequencia.add(2);
  8. sequencia.add(11);
  9. sequencia.add(12);
  10. sequencia.add(13);
  11. sequencia.add(14);
  12. sequencia.add(14);
  13. System.out.println(sequencia.stream().distinct().collect(Collectors.toList()).toString());
  14. }
  15. }
  16.  
  17. //https://pt.stackoverflow.com/q/265506/101
Success #stdin #stdout 0.15s 33548KB
stdin
Standard input is empty
stdout
[2, 11, 12, 13, 14]