Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check
isEmpty()
instead of size == 0
.
That way is simpler. It's also somewhat better for users who pass a filtered collection, **but:** - We may undo this change in the future (as we are considering approaches that would actually use the result of `size` for more than an emptiness check). - A nonempty filtered collection will still apply the filter at least once during the `isEmpty` call, so that can still cause trouble if the filter has side effects or "call the filter until it returns `true`" is slow enough to matter. - Other methods in Guava likely still trigger similar behavior when given a filtered collection, as do methods outside of Guava. Fixes #7143 (for now) RELNOTES=n/a PiperOrigin-RevId: 623232817
- Loading branch information