It's quite common to write code which ignores the value returned by a
Java method. You'll often see the Map.put(key, value) method used like that:
The compiler doesn't flag that code as an error in any way, and the value returned by the put() method is just ignored and discarded.
It's exactly the same in your example. Methods which return a value can be used in a context which doesn't expect a value, and the return value is ignored.