net.corda.contracts.asset

## Class CommodityContractKt

- net.corda.contracts.asset.CommodityContractKt

-     public class CommodityContractKt

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CommodityContract` | `getCOMMODITY_PROGRAM_ID()`
    `static Amount<net.corda.core.contracts.Issued>` | `sumCommodities(java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $receiver)` Sums the cash states in the list, throwing an exception if there are none, or if any of the cash states cannot be added together (i.e. are different currencies).
    `static Amount<net.corda.core.contracts.Issued>` | `sumCommoditiesOrNull(java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $receiver)` Sums the cash states in the list, returning null if there are none.
    `static Amount<net.corda.core.contracts.Issued>` | `sumCommoditiesOrZero(java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $receiver, Issued<net.corda.core.contracts.Commodity> currency)` Sums the cash states in the list, returning zero of the given currency if there are none.

- - ### Method Detail

    - #### getCOMMODITY_PROGRAM_ID

          public static CommodityContract getCOMMODITY_PROGRAM_ID()

    - #### sumCommodities

          public static Amount<net.corda.core.contracts.Issued> sumCommodities(java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $receiver)

      Sums the cash states in the list, throwing an exception if there are none, or if any of the cash states cannot be added together (i.e. are different currencies).

    - #### sumCommoditiesOrNull

          public static Amount<net.corda.core.contracts.Issued> sumCommoditiesOrNull(java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $receiver)

      Sums the cash states in the list, returning null if there are none.

    - #### sumCommoditiesOrZero

          public static Amount<net.corda.core.contracts.Issued> sumCommoditiesOrZero(java.lang.Iterable<? extends net.corda.core.contracts.ContractState> $receiver,
                                                                                     Issued<net.corda.core.contracts.Commodity> currency)

      Sums the cash states in the list, returning zero of the given currency if there are none.