From 90388e4701add18ec060e6b2fb219f54c9474429 Mon Sep 17 00:00:00 2001 From: stonio Date: Tue, 21 Feb 2017 15:49:26 +0100 Subject: [PATCH] Replace size() check with isEmpty() Closes gh-1333 --- .../core/convert/support/CollectionToObjectConverter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java index bcc51e2f95..052105e6ef 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ final class CollectionToObjectConverter implements ConditionalGenericConverter { return source; } Collection sourceCollection = (Collection) source; - if (sourceCollection.size() == 0) { + if (sourceCollection.isEmpty()) { return null; } Object firstElement = sourceCollection.iterator().next();