Applying Hendrik Maryns' generics changes for Entities + Validate from LANG-336

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@770891 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2009-05-02 05:20:35 +00:00
parent 8b7956d27f
commit 73ac4a0289
2 changed files with 10 additions and 18 deletions

View File

@ -749,8 +749,8 @@ public String name(int value) {
* array of entities to be added
*/
public void addEntities(String[][] entityArray) {
for (int i = 0; i < entityArray.length; ++i) {
addEntity(entityArray[i][0], Integer.parseInt(entityArray[i][1]));
for (String[] element : entityArray) {
addEntity(element[0], Integer.parseInt(element[1]));
}
}

View File

@ -258,9 +258,7 @@ public static void notEmpty(Object[] array, String message) {
* @throws IllegalArgumentException if the array is empty
*/
public static void notEmpty(Object[] array) {
if (array == null || array.length == 0) {
throw new IllegalArgumentException("The validated array is empty");
}
notEmpty(array, "The validated array is empty");
}
// notEmpty collection
@ -278,7 +276,7 @@ public static void notEmpty(Object[] array) {
* @param message the exception message you would like to see if the collection is empty
* @throws IllegalArgumentException if the collection is empty
*/
public static void notEmpty(Collection collection, String message) {
public static void notEmpty(Collection<?> collection, String message) {
if (collection == null || collection.size() == 0) {
throw new IllegalArgumentException(message);
}
@ -297,10 +295,8 @@ public static void notEmpty(Collection collection, String message) {
* @param collection the collection to check is not empty
* @throws IllegalArgumentException if the collection is empty
*/
public static void notEmpty(Collection collection) {
if (collection == null || collection.size() == 0) {
throw new IllegalArgumentException("The validated collection is empty");
}
public static void notEmpty(Collection<?> collection) {
notEmpty(collection, "The validated collection is empty");
}
// notEmpty map
@ -318,7 +314,7 @@ public static void notEmpty(Collection collection) {
* @param message the exception message you would like to see if the map is empty
* @throws IllegalArgumentException if the map is empty
*/
public static void notEmpty(Map map, String message) {
public static void notEmpty(Map<?,?> map, String message) {
if (map == null || map.size() == 0) {
throw new IllegalArgumentException(message);
}
@ -337,10 +333,8 @@ public static void notEmpty(Map map, String message) {
* @param map the map to check is not empty
* @throws IllegalArgumentException if the map is empty
*/
public static void notEmpty(Map map) {
if (map == null || map.size() == 0) {
throw new IllegalArgumentException("The validated map is empty");
}
public static void notEmpty(Map<?,?> map) {
notEmpty(map, "The validated map is empty");
}
// notEmpty string
@ -378,9 +372,7 @@ public static void notEmpty(String string, String message) {
* @throws IllegalArgumentException if the string is empty
*/
public static void notEmpty(String string) {
if (string == null || string.length() == 0) {
throw new IllegalArgumentException("The validated string is empty");
}
notEmpty(string, "The validated string is empty");
}
// notNullElements array