Cache `o.getClass()` in a local variable so we don't have to call it for every comparison.