Here you can find the source of cast(Object x)
Parameter | Description |
---|---|
x | value to cast |
T | type to cast to |
@SuppressWarnings("unchecked") static <T> T cast(Object x)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w . ja v a 2 s . c o m * Use this function to eliminate silly "unchecked" warnings that cannot be fixed in Java otherwise. * * @param x value to cast * @param <T> type to cast to * @return same value */ @SuppressWarnings("unchecked") static <T> T cast(Object x) { return (T) x; } }