Surface rule builder fixes
This commit is contained in:
parent
8809fa7dbc
commit
3a06c128ed
5 changed files with 22 additions and 28 deletions
|
@ -1,6 +1,5 @@
|
|||
package ru.bclib.util;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -44,18 +43,4 @@ public class CollectionsUtil {
|
|||
}
|
||||
return new HashMap<>(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts list into array.
|
||||
* @param list {@link List} to convert.
|
||||
* @return array of list elements. If list is empty will return empty {@link Object} array.
|
||||
*/
|
||||
public static <E> E[] toArray(List<E> list) {
|
||||
if (list.isEmpty()) {
|
||||
return (E[]) new Object[0];
|
||||
}
|
||||
E[] result = (E[]) Array.newInstance(list.get(0).getClass(), list.size());
|
||||
result = list.toArray(result);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue