List (Object object) { List list; if (object instanceof Collection) { list = new ArrayList((Collection)object); } else if (object instanceof Object[]) { list = Arrays.asList((Object[])object); } else { throw new IllegalStateException("cant handle type of " + object); } return list; }