public < P extends ParaObject > List < P > createAll ( List < P > objects ) { if ( objects == null || objects . isEmpty ( ) || objects . get ( 0 ) == null ) { return Collections . emptyList ( ) ; } final int size = this . chunkSize ; return IntStream . range ( 0 , getNumChunks ( objects , size ) ) . mapToObj ( i -> ( List < P > ) partitionList ( objects , i , size ) ) . map ( chunk -> invokePost ( "_batch" , Entity . json ( chunk ) ) ) . map ( response -> ( List < P > ) this . getEntity ( response , List . class ) ) . map ( entity -> ( List < P > ) getItemsFromList ( entity ) ) . flatMap ( List :: stream ) . collect ( Collectors . toList ( ) ) ; }
Saves multiple objects to the data store .