| 537 | } |
| 538 | |
| 539 | @SuppressWarnings("unchecked") |
| 540 | private static <T> List<T> asList(Object array) { |
| 541 | if (array == null) return null; |
| 542 | if (!isArray(array)) throw new IllegalArgumentException("The object should be an array"); |
| 543 | int length = getLength(array); |
| 544 | List<T> list = new ArrayList<T>(length); |
| 545 | for (int i = 0; i < length; i++) { |
| 546 | list.add((T) Array.get(array, i)); |
| 547 | } |
| 548 | return list; |
| 549 | } |
| 550 | |
| 551 | @SuppressWarnings("unchecked") |
| 552 | private static Comparable<Object>[] arrayOfComparableItems(Object array) { |