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;
}

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 ; }
take a list of itemstacks and amalgamate where possible . < br >
