Use Collection.isEmpty() instead of size() == 0
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1199983 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
371e866442
commit
1460653475
|
@ -296,7 +296,7 @@ public class Validate {
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
throw new NullPointerException(String.format(message, values));
|
throw new NullPointerException(String.format(message, values));
|
||||||
}
|
}
|
||||||
if (collection.size() == 0) {
|
if (collection.isEmpty()) {
|
||||||
throw new IllegalArgumentException(String.format(message, values));
|
throw new IllegalArgumentException(String.format(message, values));
|
||||||
}
|
}
|
||||||
return collection;
|
return collection;
|
||||||
|
@ -345,7 +345,7 @@ public class Validate {
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
throw new NullPointerException(String.format(message, values));
|
throw new NullPointerException(String.format(message, values));
|
||||||
}
|
}
|
||||||
if (map.size() == 0) {
|
if (map.isEmpty()) {
|
||||||
throw new IllegalArgumentException(String.format(message, values));
|
throw new IllegalArgumentException(String.format(message, values));
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
|
|
|
@ -522,7 +522,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
||||||
* @return <code>true</code> if some Object was found, <code>false</code> otherwise.
|
* @return <code>true</code> if some Object was found, <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
private boolean containsElements(Collection<?> coll) {
|
private boolean containsElements(Collection<?> coll) {
|
||||||
if (coll == null || coll.size() == 0) {
|
if (coll == null || coll.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Object name : coll) {
|
for (Object name : coll) {
|
||||||
|
|
Loading…
Reference in New Issue