Intersection of Multiple Arrays

给几个数组, 求所有数字重复的, 并且排序.

class Solution {
    public List<Integer> intersection(int[][] nums) {
        Set<Integer> set = new HashSet<>();
        for(int n : nums[0])
            set.add(n);
        for(int i = 1; i < nums.length; i++) {
            Set<Integer> tmp = new HashSet<>();
            for(int j = 0; j < nums[i].length; j++) {
                tmp.add(nums[i][j]);
            }
            set.retainAll(tmp);
        }
        
        List<Integer> list = new ArrayList<>();
        for(int n : set)
            list.add(n);
        Collections.sort(list);
        return list;
    }
}