List of utility methods to do List Cast
java.util.List | castListUnchecked(Object list) cast List Unchecked return (java.util.List<T>) list;
|
List | castNonNullListParameterTo(String parameterName, List cast Non Null List Parameter To if (value == null) { throw new IllegalArgumentException(parameterName + " is null"); for (T entry : value) { if (entry == null) { throw new IllegalArgumentException("One entry of " + parameterName + " is null."); if (!requiredType.isInstance(entry)) { ... |
List | castOrCopyToList(Iterable cast Or Copy To List if (iterable instanceof List) { return (List<E>) iterable; List<E> list = new ArrayList<E>(); for (E e : iterable) { list.add(e); return list; ... |
List | castTo(final List> list, final Class cast To if (isOf(list, clasz)) { return (List<E>) list; throw new IllegalArgumentException("List contains invalid type."); |
List | castToDocumentList(Object obj) Casts the specified object to a List |
List | castToList(U[] array, Class Convert an array to a list of a different type. final List<T> res = new ArrayList<T>(array.length); for (final U item : array) { res.add(clazz.cast(item)); return res; |
List | castToStringList(Object value) cast To String List List<String> result; try { result = (List<String>) value; } catch (Exception e) { result = null; if (result == null) { return new ArrayList<String>(); ... |
boolean | IS_CASTABLE_LIST(Class> className, Object obj) ICASTABLLIST if (!(obj instanceof List)) return false; for (Object o : (List<?>) obj) if (!className.isInstance(o)) return false; return true; |
String | listToJsonArray(List ll, Class toCast, String jsonArrayKey) list To Json Array StringBuilder temp = new StringBuilder(); try { boolean hasData = false; Iterator ite = ll.listIterator(); temp.append("{\""); temp.append(jsonArrayKey); temp.append("\":["); while (ite.hasNext()) { ... |
List | toStringList(List to String List List<String> values = new ArrayList<String>(uncastedValues.size()); for (Object object : uncastedValues) { values.add(String.valueOf(object)); return values; |