function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Iryna ZasikanIryna Zasikan 

Is it possible to use stream().Collectors in apex?

I want to use something like this in my trigger:
Map<Id, Id> result = anAttachmentList.stream().collect( Collectors.groupingBy( Function.identity(), Collectors.counting() ) );
Unfortuntly my Force.com IDE can't understand stream().collect.
Does anyone know is it available in Apex?
Best Answer chosen by Iryna Zasikan
karthikeyan perumalkarthikeyan perumal
Hello, 

Stream.Collect is not avaliable in apex. its Java 8. 

you have to achive this using set and map. there is no built in operation "Stream.Collect (accumulator,combiner,finisher)"

Hope this will help you. 

Mark it BestANSWER if its clear. 
Thanks
karthik