private static void writeIterator(Appendable appendable, Iterator<?> iterator) throws IOException {
        if (iterator != null && iterator.hasNext()) {
            deepToString(appendable, iterator.next());
            while (iterator.hasNext()) {
                appendable.append(ITERABLE_NEXT);
                deepToString(appendable, iterator.next());
            }
        }
    }