How to perform java Streams Operation in MPS?

Hi,

 

I am having a list in the type of some model and having 100's of data 

List<PersonDetail> personalData=new ArrayList<PersonDetail>();

 

I want to perform the Java Stream Operation like

personalData.stream().forEach(x->System.out.println(x));

personalData.stream().forEach(System.out::println);

 

personalData.stream().filter(some predicate to check).collect(Collectors.toList());

 

 

How can i do this kind of Operations in MPS?

 

2 comments
Comment actions Permalink

You can use the stream() function but MPS doesn't support the lambda syntax from Java 8. Instead you can use the closures language (jetbrains.mps.baseLanguage.closures). Try this in the MPS Console (one of the tool windows at the bottom of the IDE window):

On the other hand, the MPS collections language is often nicer to use. See the documentation (including subtopics on the left) at https://www.jetbrains.com/help/mps/collections-language.html.

1
Comment actions Permalink

it's works perfectly as it is..

 

Thanks for your response Sergej Koščejev

0

Please sign in to leave a comment.