public <T>ObjectArray<T> resize(ObjectArray<T> array,long size){
  if (array instanceof BigObjectArray) {
    return resizeInPlace((BigObjectArray<T>)array,size);
  }
 else {
    final ObjectArray<T> newArray=newObjectArray(size);
    for (long i=0, end=Math.min(size,array.size()); i < end; ++i) {
      newArray.set(i,array.get(i));
    }
    array.close();
    return newArray;
  }
}

public < T > ObjectArray < T > resize ( ObjectArray < T > array , long size ) { if ( array instanceof BigObjectArray ) { return resizeInPlace ( ( BigObjectArray < T > ) array , size ) ; } else { final ObjectArray < T > newArray = newObjectArray ( size ) ; for ( long i = 0 , end = Math . min ( size , array . size ( ) ) ; i < end ; ++ i ) { newArray . set ( i , array . get ( i ) ) ; } array . close ( ) ; return newArray ; } }
resize the array to the exact provided size .
