Hi Jeroen, you can also use Flow.<List<VerwerkingsResultaat>>empty(), that will immediately give you the right type. Flow.of() is a workaround for Java’s broken(*) type argument syntax, but it only works for non-parameterized types.
Regards, Roland (*) Why would it make sense to place the type before the method name? > 8 sep 2015 kl. 16:25 skrev Jeroen Kransen <[email protected]>: > > Double casting seems to do the trick: > > @SuppressWarnings("unchecked") > Class<List<VerwerkingsResultaat>> cls = > (Class<List<VerwerkingsResultaat>>) (Object) List.class; > > > Op dinsdag 8 september 2015 16:06:17 UTC+2 schreef Jeroen Kransen: > I'm struggling again with the types in Java. I want to group elements in a > Flow, and call a processing step like this: > > final Flow<List<VerwerkingsResultaat>, Integer, BoxedUnit> > saveOrganisatiesFlow = Flow.of(List.class).mapAsync(4, new > Function<List<VerwerkingsResultaat>, Future<Integer>>() { > @Override > public Future<Integer> apply(List<VerwerkingsResultaat> > verwerkingsResultaten) throws Exception { > return Futures.successful(1); > } > }); > Future<BoxedUnit> future = recordSource.grouped(1000) > .via(saveOrganisatiesFlow) > .runWith(printingSink, materializer); > > Of course there is a collission between the type List<VerwerkingsResultaat> > and the Flow.of(List.class). How can I group elements like this in Java? > > Jeroen > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/> > >>>>>>>>>> Check the FAQ: > >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html> > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > >>>>>>>>>> <https://groups.google.com/group/akka-user> > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/akka-user > <http://groups.google.com/group/akka-user>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. Dr. Roland Kuhn Akka Tech Lead Typesafe <http://typesafe.com/> – Reactive apps on the JVM. twitter: @rolandkuhn <http://twitter.com/#!/rolandkuhn> -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
