fork(1) download
  1. import java.util.*;
  2. import java.util.stream.*;
  3.  
  4. class Ideone {
  5. public static void main (String[] args) {
  6. int[][] matrix = {{1, 2, 2, 4, 4},{4, 2, 1, 4}, {3, 2, 4, 1, 5, 8}};
  7. Set<Set<Integer>> sets = new HashSet<>();
  8.  
  9. List<int[]> nonSimilar = Arrays.stream(matrix)
  10. .filter(row -> sets.add(Arrays.stream(row).boxed().collect(Collectors.toSet())))
  11. .collect(Collectors.toList());
  12.  
  13. nonSimilar.stream().map(Arrays::toString).forEach(System.out::println);
  14. }
  15. }
Success #stdin #stdout 0.13s 2184192KB
stdin
Standard input is empty
stdout
[1, 2, 2, 4, 4]
[3, 2, 4, 1, 5, 8]