question: public static List < ItemStack > consolidateItemStacks ( List < ItemStack > inputStacks ) { List < ItemStack > outputStacks = new ArrayList < ItemStack > ( ) ; for ( ItemStack sourceIS : inputStacks ) { boolean bFound = false ; for ( ItemStack destIS : outputStacks ) { if ( destIS != null && sourceIS != null && itemStackIngredientsMatch ( destIS , sourceIS ) ) { bFound = true ; destIS . stackSize += sourceIS . stackSize ; } } if ( ! bFound ) outputStacks . add ( sourceIS . copy ( ) ) ; } return outputStacks ; }
target:  Take a list of ItemStacks and amalgamate where possible.<br>