package com.raj.utility;
import java.util.ArrayList;
import java.util.List;
public class ArrayUtil {
/
public static boolean isNullOrEmpty(T[] array) {
return (array == null || array.length == 0);
}
public static boolean notNullOrEmpty(T[] array) {
return !isNullOrEmpty(array);
}
public static String[] trim(String[] array) {
if (array == null) {
return null;
}
for (int i = 0; i < array.length; i++) {
array[i] = array[i].trim();
}
return array;
}
public static List toList(String[] array) {
java.util.List list = new ArrayList(array.length);
for (String entry : array) {
list.add(entry);
}
return list;
}
public static String[] asArray(List list) {
if (list == null) return null;
return list.toArray(new String[0]);
}
}
import java.util.ArrayList;
import java.util.List;
public class ArrayUtil {
/
public static
return (array == null || array.length == 0);
}
public static
return !isNullOrEmpty(array);
}
public static String[] trim(String[] array) {
if (array == null) {
return null;
}
for (int i = 0; i < array.length; i++) {
array[i] = array[i].trim();
}
return array;
}
public static List
java.util.List
for (String entry : array) {
list.add(entry);
}
return list;
}
public static String[] asArray(List
if (list == null) return null;
return list.toArray(new String[0]);
}
}
No comments:
Post a Comment