nonEmptyEntries property

Iterable<(Pos, E)> nonEmptyEntries

Entries in the grid that are not equal to empty, in row-major order.

Useful for operations that need to iterate over non-empty entries, such as drawing the grid:

clearScreen();
for (final (pos, node) in grid.nonEmptyEntries) {
  drawNode(pos, node);
}

Iterating, Iterable.first, and Iterable.last are efficient operations.

Implementation

Iterable<(Pos, E)> get nonEmptyEntries;