filterCommands

fun <T : CommandData> filterCommands(clazz: Class<T>, predicate: Predicate<T>): List<Command<T>>

Helper to simplify filtering Command items according to a Predicate.

Return

the possibly empty list of Command items with CommandData values matching the predicate and clazz restrictions.

Parameters

clazz

The class type used for filtering via an Class.isInstance check. clazz must be an extension of CommandData.

predicate

A filtering function taking a CommandData item of type T and returning true if it should be included in the list. The class filtering is applied before the predicate.


inline fun <T : CommandData> filterCommands(crossinline predicate: (T) -> Boolean): List<Command<T>>