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?

Mathias Soeken
  • 1,293
  • 2
  • 8
  • 22

1 Answers1

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

thSoft
  • 21,755
  • 5
  • 88
  • 103
Sebastian Zarnekow
  • 6,609
  • 20
  • 23