@ SuppressWarnings ( "unchecked" ) public static < T > void flatten ( Collection < Object > input , Collection < Object > flattenOutput ) throws Exception { if ( input == null || input . isEmpty ( ) || flattenOutput == null ) return ; for ( Object inputObj : input ) { if ( inputObj instanceof Exception ) throw ( Exception ) inputObj ; if ( inputObj == null ) continue ; if ( inputObj instanceof Collection ) flatten ( ( Collection < Object > ) inputObj , flattenOutput ) ; else flattenOutput . add ( inputObj ) ; } }
Used to flatten results from multiple servers