var productsInOrderIterator : Iterator = parentOrder.getProductLineItems().iterator(); var productLineMap: HashMap = new HashMap(); while(!empty(productsInOrderIterator) && productsInOrderIterator.hasNext()) { var productLineItem : ProductLineItem = productsInOrderIterator.next(); var wareHouseID : String = productLineItem.product.custom.warehouseID ; if (!productLineMap.containsKey(wareHouseID)) { var arrayList = new ArrayList(); arrayList.push(productLineItem); productLineMap.put(wareHouseID, arrayList); } else{ var arrayList = productLineMap.get(wareHouseID); arrayList.push(productLineItem); productLineMap.put(wareHouseID, arrayList); } }// end loop