Java List Cast castList(Class clazz, Collection c)

Here you can find the source of castList(Class clazz, Collection c)

Description

cast List

License

LGPL

Declaration

private static <T> List<T> castList(Class<? extends T> clazz, Collection<?> c) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class Main {
    private static <T> List<T> castList(Class<? extends T> clazz, Collection<?> c) {
        List<T> r = new ArrayList<T>(c.size());
        for (Object o : c)
            r.add(clazz.cast(o));/*from ww w . java  2s . c  om*/
        return r;
    }
}

Related

  1. cast(List list)
  2. cast(List list)
  3. cast(List list, Class klass)
  4. cast(List from)
  5. CAST_LIST(Class className, Object obj)
  6. castList(Class clazz, Collection c)
  7. castList(Class clazz, Collection collection)
  8. castList(Class elementType, List list)
  9. castList(Class klass, List list)