commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1199983 - in /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3: Validate.java text/ExtendedMessageFormat.java
Date Wed, 09 Nov 2011 21:41:24 GMT
Author: ggregory
Date: Wed Nov  9 21:41:24 2011
New Revision: 1199983

URL: http://svn.apache.org/viewvc?rev=1199983&view=rev
Log:
Use Collection.isEmpty() instead of size() == 0

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java?rev=1199983&r1=1199982&r2=1199983&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/Validate.java Wed Nov
 9 21:41:24 2011
@@ -296,7 +296,7 @@ public class Validate {
         if (collection == null) {
             throw new NullPointerException(String.format(message, values));
         }
-        if (collection.size() == 0) {
+        if (collection.isEmpty()) {
             throw new IllegalArgumentException(String.format(message, values));
         }
         return collection;
@@ -345,7 +345,7 @@ public class Validate {
         if (map == null) {
             throw new NullPointerException(String.format(message, values));
         }
-        if (map.size() == 0) {
+        if (map.isEmpty()) {
             throw new IllegalArgumentException(String.format(message, values));
         }
         return map;

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java?rev=1199983&r1=1199982&r2=1199983&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
Wed Nov  9 21:41:24 2011
@@ -522,7 +522,7 @@ public class ExtendedMessageFormat exten
      * @return <code>true</code> if some Object was found, <code>false</code>
otherwise.
      */
     private boolean containsElements(Collection<?> coll) {
-        if (coll == null || coll.size() == 0) {
+        if (coll == null || coll.isEmpty()) {
             return false;
         }
         for (Object name : coll) {



Mime
View raw message