how to write (existing) java 8 lambda in xtend [message #1787310] |
Wed, 23 May 2018 09:45  |
Eclipse User |
|
|
|
Hi
after consulting the xtend documentation and http://blog.efftinge.de/2012/12/java-8-vs-xtend.html
I am stuck with the following problem:
my original code is:
@Override
public Set<AccessionLink> getAccessionLinks(ElementState state)
{
return this.accessionLinks.stream().filter(element -> state.check(element.isDeleted())).collect(Collectors.toSet());
}
accessionLinks is as HashSet of JpaAccessionLink (derived as subclass from AccessionLink), ElementState is an enum that does a check if the element has to be filtered out. The return value should be converted from Set<JpaAccessionLink> to Set<AccessionLink>. I tried with
override Set<JpaAccessionLink> getAccessionLinks(ElementState state)
{
accessionLinks.stream.filter(e | state.check(deleted)).collect(Collectors.toSet)
}
But that is not the solution I am looking for because I need to override the given method and so must give a Set<AccessionLink> as return value. I had other tries too, but did not succeed. I would be glad, if someone could give me a solution to the problem. Thank you
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05467 seconds