cast List to List<T> - Java java.util

Java examples for java.util:List Operation

Description

cast List to List<T>

Demo Code


//package com.java2s;
import java.util.List;

public class Main {
    public static void main(String[] argv) {
        List source = java.util.Arrays.asList("asdf", "java2s.com");
        System.out.println(castList(source));
    }//from  w w  w . j  a  va  2 s  .c om

    public static <T> List<T> castList(final List source) {
        return (List<T>) source;
    }
}

Related Tutorials