コード例 #1
0
 private long calculateQuantity(List<StockCardEntry> stockCardEntryList) {
   long result = 0;
   for (StockCardEntry entry : stockCardEntryList) {
     result += entry.getQuantity();
   }
   return result;
 }
コード例 #2
0
  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;
  }