Minor: add a kdoc to the select function.

This commit is contained in:
Mike Hearn 2015-11-16 19:27:39 +01:00
parent 0aa643d4c2
commit 5f30684805

View File

@ -94,6 +94,8 @@ fun Iterable<Amount>.sumOrThrow() = reduce { left, right -> left + right }
fun Iterable<Amount>.sumOrZero(currency: Currency) = if (iterator().hasNext()) sumOrThrow() else Amount(0, currency)
//// Authenticated commands ///////////////////////////////////////////////////////////////////////////////////////////
/** Filters the command list by type, institution and public key all at once. */
inline fun <reified T : Command> List<AuthenticatedObject<Command>>.select(signer: PublicKey? = null, institution: Institution? = null) =
filter { it.value is T }.
filter { if (signer == null) true else it.signers.contains(signer) }.