Fixed rubocop's CollectionMethods warnings.