Here you can find the source of cast(List> list)
@SuppressWarnings("unchecked") public static <T> List<T> cast(List<?> list)
//package com.java2s; import java.util.List; import java.util.Map; public class Main { @SuppressWarnings("unchecked") public static <T> List<T> cast(List<?> list) { return (List<T>) list; }//from w ww.ja va 2 s . c o m @SuppressWarnings("unchecked") public static <K, V> Map<K, V> cast(Map<?, ?> map) { return (Map<K, V>) map; } }