[xtend] how to pass a function to method to use in filter [message #1415244] |
Tue, 02 September 2014 11:55 |
Marc Schlegel Messages: 69 Registered: July 2009 |
Member |
|
|
I am having a little problem with the xTend syntax.
I would like to pass a function to a utility-method, which applies this function to the filter of a list.
private def void doStuff(Iterable<MyType> list, (MyType) => Boolean filterFunction)
{
val result = list.filter[filterFunction] // syntax-error: cannot convert from (MyType) => (MyType) => Boolean to Function1
.... work on result
}
...
doStuff(intputList)[e | e.isTrue] // compiles nicely
My filterFunction maps MyType to Boolean, so why cant I use it in InterableExtensions.filter?
Thanks
[Updated on: Tue, 02 September 2014 11:56] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02429 seconds