public class MyArrayTool { private Object items; private Collection collection; public void setItems(Object items) { //collection this.items = items; //list set if(items instanceof Collection){ collection = (Collection) items; } if(items instanceof Map){ Map map = (Map) items; collection = map.entrySet(); } if(items.getClass().isArray()){ collection = new ArrayList(); for(int i=0;i