Mathias Soeken
Mathias Soeken

Reputation: 1303

Combine filter and map in Xtend collections

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?

Upvotes: 5

Views: 2131

Answers (1)

Sebastian Zarnekow
Sebastian Zarnekow

Reputation: 6729

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).

Upvotes: 8

Related Questions