public void updatePosition(String key, Order order, int pmId, int quantity) { Deal deal = new Deal(quantity, order.price); Position position = mapPositions.get(key); if (position == null) { position = new Position(order.instrumentId); } else if (position.getDealSize() > 100) { for (int i = 0; i < 10; i++) { position.lsDeals.remove(0); } } position.addDeal(deal); mapPositions.put(key, position); }