mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-28 21:19:06 +00:00
Type doesn't need to be ArrayList, and updating for loops
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@772553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d744b2267
commit
a60f59ac93
@ -20,9 +20,11 @@
|
||||
import java.lang.reflect.AccessibleObject;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.ClassUtils;
|
||||
@ -340,9 +342,8 @@ static String[] toNoNullStringArray(Collection<String> collection) {
|
||||
* @return The given array or a new array without null.
|
||||
*/
|
||||
static String[] toNoNullStringArray(Object[] array) {
|
||||
ArrayList<String> list = new ArrayList<String>(array.length);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
Object e = array[i];
|
||||
List<String> list = new ArrayList<String>(array.length);
|
||||
for (Object e : array) {
|
||||
if (e != null) {
|
||||
list.add(e.toString());
|
||||
}
|
||||
@ -526,8 +527,7 @@ protected void appendFieldsIn(Class<?> clazz) {
|
||||
}
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
AccessibleObject.setAccessible(fields, true);
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
Field field = fields[i];
|
||||
for (Field field : fields) {
|
||||
String fieldName = field.getName();
|
||||
if (this.accept(field)) {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user