I have a 2-D array of ints, and a method with an argument that points to one of its rows. I want to return a Set over the elements of that row that are non-zero, and I want to do it without a for loop. So this is what I have tried:
public Set<Integer> getNeighbors(int node) {
        assert node >= 0 && node < numNodes : "getNeighbors(): Invalid node parameter given: " + node + ".";
       return Arrays.stream(matrix[node]).filter(n->n>0).collect(Collectors.toSet());
    }
Unfortunately, I'm getting a compile-time error which is a bit hard to parse:
Any ideas?

 
     
     
    