Use empty not size

Simple optimization and cleanup to use container.empty() to check for empty-ness instead of container.size().