com.r3corda.contracts.asset / kotlin.collections.Iterable

Extensions for kotlin.collections.Iterable

sumCash fun Iterable<ContractState>.sumCash(): Amount<Issued<Currency>>

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 or issuers).

sumCashBy fun Iterable<ContractState>.sumCashBy(owner: PublicKey): Amount<Issued<Currency>>

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

sumCashOrNull fun Iterable<ContractState>.sumCashOrNull(): Amount<Issued<Currency>>?

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

sumCashOrZero fun Iterable<ContractState>.sumCashOrZero(currency: Issued<Currency>): Amount<Issued<Currency>>

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

sumCommodities fun Iterable<ContractState>.sumCommodities(): <ERROR CLASS>

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 fun Iterable<ContractState>.sumCommoditiesOrNull(): <ERROR CLASS>

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

sumCommoditiesOrZero fun Iterable<ContractState>.sumCommoditiesOrZero(currency: Issued<Commodity>): <ERROR CLASS>

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

sumFungibleOrNull fun <T> Iterable<ContractState>.sumFungibleOrNull(): <ERROR CLASS>

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

sumFungibleOrZero fun <T> Iterable<ContractState>.sumFungibleOrZero(token: Issued<T>): <ERROR CLASS>

Sums the asset states in the list, returning zero of the given token if there are none.

sumObligations fun <P> Iterable<ContractState>.sumObligations(): Amount<Issued<Terms<P>>>

Sums the obligation states in the list, throwing an exception if there are none. All state objects in the list are presumed to be nettable.

sumObligationsOrNull fun <P> Iterable<ContractState>.sumObligationsOrNull(): Amount<Issued<Terms<P>>>?

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

sumObligationsOrZero fun <P> Iterable<ContractState>.sumObligationsOrZero(issuanceDef: Issued<Terms<P>>): Amount<Issued<Terms<P>>>

Sums the obligation states in the list, returning zero of the given product if there are none.