Given some repetitive variable v and type T , I often find myself writing code like
v
T
v.filter[it instanceof T].map[it as T]
Is there any helper that performs the same functionality in one step?
You can use v.filter(T) (or the legacy v.filter(typeof(T)) syntax), which is the v.filter(T.class) syntax for the Java equivalent v.filter(T.class) .
v.filter(T)
v.filter(typeof(T))
v.filter(T.class)