The Pos class could be made a bit more efficient. In particular, the sum(Iterable<Pos>) method converts the positions to a list. It should instead create a Pos.Builder and iterate over the positions; no need to create a list.
Probably other methods would benefit from the same approach.
As part of this task, write tests for the methods affected, and check that behavior is the same before and after.
The
Posclass could be made a bit more efficient. In particular, thesum(Iterable<Pos>)method converts the positions to a list. It should instead create aPos.Builderand iterate over the positions; no need to create a list.Probably other methods would benefit from the same approach.
As part of this task, write tests for the methods affected, and check that behavior is the same before and after.