@ SuppressWarnings ( { "unchecked" , "PMD.ShortVariable" , "PMD.AvoidDuplicateLiterals" } ) public < C > C [ ] channels ( Class < C > type ) { return Arrays . stream ( channels ) . filter ( c -> type . isAssignableFrom ( c . getClass ( ) ) ) . toArray ( size -> ( C [ ] ) Array . newInstance ( type , size ) ) ; }
Returns the subset of channels that are assignable to the given type .