public static <E> E[] unmarshallArray(ObjectInput in, ArrayBuilder<E> builder) throws IOException, ClassNotFoundException {
      final int size = unmarshallSize(in);
      if (size == NULL_VALUE) {
         return null;
      }
      final E[] array = Objects.requireNonNull(builder, "ArrayBuilder must be non-null").build(size);
      for (int i = 0; i < size; ++i) {
         //noinspection unchecked
         array[i] = (E) in.readObject();
      }
      return array;
   }
public static < E > E [ ] unmarshallArray ( ObjectInput in , ArrayBuilder < E > builder ) throws IOException , ClassNotFoundException { final int size = unmarshallSize ( in ) ; if ( size == NULL_VALUE ) { return null ; } final E [ ] array = Objects . requireNonNull ( builder , "ArrayBuilder must be non-null" ) . build ( size ) ; for ( int i = 0 ; i < size ; ++ i ) { array [ i ] = ( E ) in . readObject ( ) ; } return array ; }
Unmarshall arrays.

@param in      {@link ObjectInput} to read.
@param builder {@link ArrayBuilder} to build the array.
@param <E>     Array type.
@return The populated array.
@throws IOException            If any of the usual Input/Output related exceptions occur.
@throws ClassNotFoundException If the class of a serialized object cannot be found.
@see #marshallArray(Object[], ObjectOutput).