public static List < Block > removeEmptyBlocks ( final Collection < Block > blocks ) { List < Block > cleanBlocks = Lists . newArrayListWithExpectedSize ( blocks . size ( ) ) ; for ( Block block : blocks ) { if ( block . content . isEmpty ( ) ) { continue ; } if ( isWhitespace ( block . content ) ) { continue ; } cleanBlocks . add ( block ) ; } return cleanBlocks ; }
Removes empty blocks from a collection of blocks .