List of utility methods to do List Cast
List | castList(Class extends T> clazz, Collection> c) This method verifies the content of a list. List<T> r = new ArrayList<T>(c.size()); for (Object o : c) r.add(clazz.cast(o)); return r; |
List | castList(Class extends T> clazz, Collection> c) cast List List<T> r = new ArrayList<T>(c.size()); for (Object o : c) r.add(clazz.cast(o)); return r; |
List | castList(Class extends T> clazz, Collection> collection) Casts a raw Collection to a generic List . List<T> genericList = new ArrayList<T>(collection.size()); for (Object object : collection) { genericList.add(clazz.cast(object)); return genericList; |
List | castList(Class cast List if (list == null) { return null; for (Object element : list) { if (!elementType.isAssignableFrom(element.getClass())) { throw new Exception("List element has invalid type -- expected '" + elementType.getName() + "', got: " + element.getClass().getName()); return (List<T>) list; |
List | castList(Class cast List return castList(klass, list, false);
|
List | castList(Collection INTERNAL: Cast collection as list or make a new list. if (c instanceof List) return (List<T>) c; else return new ArrayList<T>(c); |
List | castList(final List Convert a list of type List List<T> result = new ArrayList<T>(); for (E record : original) result.add((T) record); return Collections.unmodifiableList(result); |
List | castList(final Object object) Cast Object to List . return (List<T>) object;
|
List | castList(List Casts a list containing elements of class T to a list containing elements of a subclass E. return (List<E>) list;
|
List | castListElem(List Creates a new list of the objects cast as the type passed as target. List<V> result = new ArrayList<V>(list.size()); for (T elem : list) { result.add((V) elem); return result; |