We can use Aggregation API to find the total size (object count) of a collection:
var things = client.collections.use("Things");
var count = things.aggregate.overAll(opt -> opt.includeTotalCount(true)).totalCount();
For convenience, let's provide a helper things.size() that does the same thing idiomatically.