Combine filter and map in Xtend collections
Asked Answered
P

1

5

Given some iterable variable v and a type T I often find myself writing code such as

v.filter[it instanceof T].map[it as T]

Does there exist some helper which does the same functionality in a single step?

Pseudaxis answered 10/4, 2013 at 14:12 Comment(0)
A
8

You may want to use v.filter(T) (or the legacy syntax v.filter(typeof(T))) which is Xtend's syntax for the Java equivalent v.filter(T.class).

Arose answered 11/4, 2013 at 6:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.