Some collections implementations, e.g. naive linked lists, concurrent collections, may spend O(n) time iterating through themselves to calculate their size. isEmpty() just needs to determine if there is at least one element - it's optimizable - so we should always expect isEmpty() to be as fast, or faster, than size() > 0.