public static <A> List<A> toList(Collection<A> objects) {
        List<A> list;
        if (objects instanceof List) {
            list = (List<A>) objects;
        } else {
            list = new ArrayList<A>(objects);
        }
        return list;
    }