public Collection<E> read(Unpacker u, Collection<E> to, boolean required)
            throws IOException {
        if (!required && u.trySkipNil()) {
            return null;
        }
        int n = u.readArrayBegin();
        if (to == null) {
            to = new LinkedList<E>();
        } else {
            to.clear();
        }
        for (int i = 0; i < n; i++) {
            E e = elementTemplate.read(u, null);
            to.add(e);
        }
        u.readArrayEnd();
        return to;
    }