You are viewing a single comment's thread. Return to all comments →
//This is my solution, use in case to need
public static void main(String[] args) { List<Object> result = Arrays.asList(1, 2, 3, "Hello","World"); for (Object object : result) { if(object instanceof String){ System.out.println(object.toString()); }else{ Integer temp =(Integer) object; System.out.println(temp); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Generics
You are viewing a single comment's thread. Return to all comments →
//This is my solution, use in case to need