Here you can find the source of cast(List> list)
@SuppressWarnings("unchecked") public static <T> List<T> cast(List<?> list)
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 Google, Inc./*from w ww. j a v a 2 s . co m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Google, Inc. - initial API and implementation *******************************************************************************/ import java.util.List; public class Main { /** * Helper method for cast any {@link List} to generic list. */ @SuppressWarnings("unchecked") public static <T> List<T> cast(List<?> list) { return (List<T>) list; } }