private long calculateQuantity(List<StockCardEntry> stockCardEntryList) { long result = 0; for (StockCardEntry entry : stockCardEntryList) { result += entry.getQuantity(); } return result; }
private String getExpirationDateFromStockCardEntry(StockCardEntry entry) { Optional<StockCardEntryKV> stockCardEntryKVOptional = from(entry.getKeyValues()) .firstMatch( new Predicate<StockCardEntryKV>() { @Override public boolean apply(StockCardEntryKV input) { return EXPIRATION_DATES.equalsIgnoreCase(input.getKeyColumn()); } }); if (stockCardEntryKVOptional.isPresent()) { return stockCardEntryKVOptional.get().getValueColumn(); } return StringUtils.EMPTY; }