Thanks for raising this, we should fix it <https://github.com/akka/akka/issues/17635> for Akka 2.4 by offering a method that gives you an Optional instead of a Scala Option.
Regards, Roland > 1 jun 2015 kl. 02:50 skrev Guido Medina <[email protected]>: > > Is there any way to avoid the verbosity?, I try with a more functional > approach which was OK for IntelliJ but not for the Java 8 compiler, here is > the form that is working: > > private void applyToAccount(Currency currency, BalanceOperation operation) { > context().child(currency.code). > getOrElse(new AbstractFunction0<Option<ActorRef>>() { > @Override > public Option<ActorRef> apply() { > return > Option.some(context().actorOf(balancePersistorProps(currency), > currency.code)); > } > }). > get().forward(operation, context); > } > > > But I was hoping the following would work, but Java 8 can't infer the type, > strange IntelliJ recognizes it I guess the mix of Java and Scala drives it > crazy: > > > private void applyToAccount(Currency currency, BalanceOperation operation) { > context().child(currency.code). > getOrElse(() -> > Option.some(context().actorOf(balancePersistorProps(currency), > currency.code))). > get().forward(operation, context); > } > > > Best regards. > > -- > >>>>>>>>>> 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.
