Here you can find the source of copyList(Object object)
public static List<String> copyList(Object object)
//package com.java2s; //License from project: LGPL import java.util.ArrayList; import java.util.List; public class Main { public static List<String> copyList(Object object) { if (!(object instanceof List)) { return new ArrayList<>(); }/*w w w. j av a 2 s . c o m*/ List<?> list = (List<?>) object; List<String> temp = new ArrayList<>(); for (Object ob : list) { if (ob instanceof String) { temp.add((String) ob); } else if (ob == null) { temp.add(null); } else { return new ArrayList<>(); } } return temp; } }