public int readExternalizableCollection(DataInput in, Collection<? extends Externalizable> value, ClassLoader loader) throws IOException {
        Collection<Externalizable> result = (Collection<Externalizable>) readObject(loader, in);
        if (result == null) return 0;
        ((Collection<Externalizable>)value).addAll(result);
        return result.size();
    }
Reads a collection of Externalizable objects and adds them to the collection passed as a parameter. The
collection passed as a parameter must be a collection and not a <tt>null</null> value.

@param in the input stream.
@param value the collection of Externalizable objects. This value must not be null.
@param loader class loader to use to build elements inside of the serialized collection.
@throws IOException if an error occurs.
@return the number of elements added to the collection.
xmppserver/src/main/java/org/jivesoftware/util/cache/DefaultExternalizableUtil.java