Here you can find the source of cast(List
@SuppressWarnings("unchecked") public static <E, F extends E> List<E> cast(List<F> from)
//package com.java2s; import java.util.List; public class Main { @SuppressWarnings("unchecked") public static <E, F extends E> List<E> cast(List<F> from) { return (List<E>) from; }/*from w w w .j av a 2 s. c o m*/ }