code: public Stream<IntPair> adjacent8Points(final int i, final int j) {
          final IntPair up = i == 0 ? null : IntPair.of(i - 1, j);
          final IntPair right = j == cols - 1 ? null : IntPair.of(i, j + 1);
          final IntPair down = i == rows - 1 ? null : IntPair.of(i + 1, j);
          final IntPair left = j == 0 ? null : IntPair.of(i, j - 1);
  
          final IntPair leftUp = i > 0 && j > 0 ? IntPair.of(i - 1, j - 1) : null;
          final IntPair rightUp = i > 0 && j < cols - 1 ? IntPair.of(i - 1, j + 1) : null;
          final IntPair rightDown = i < rows - 1 && j < cols - 1 ? IntPair.of(j + 1, j + 1) : null;
          final IntPair leftDown = i < rows - 1 && j > 0 ? IntPair.of(i + 1, j - 1) : null;
  
          return Stream.of(leftUp, up, rightUp, right, rightDown, down, leftDown, left);
      }
docs: Returns the eight adjacencies with order: left-up, up, right-up, right, right-down, down, left-down, left. <code>null</code> is set if the adjacency doesn't exist.
  
  @param i
  @param j
  @return