Package 

Object Continue


  • 
    public class Continue
    
                        

    A static helper class allowing Java invocations to Kotlin coroutines a little easier on the eye. When invoking a suspending function in Java there is an extra parameter on the signature accepting a Continuation. Typically this would require creating an anonymous object to implement both Continuation.context and Continuation.resumeWith. This class allows you to accomplish the same thing with a more inline/lambda approach:

    someSuspendingMethod(normalArg1, normalArg2, Continue.with(result -> { ... }))

    if you don't need to continue with anything you can simply use:

    someSuspendingMethod(normalArg1, normalArg2, Continue.none())
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static Continue INSTANCE
    • Method Summary

      Modifier and Type Method Description
      final static <R extends Any> Continuation<R> with(Consumer<ContinueResult<R>> onFinished, CoroutineContext context) Allows java code to provide a lambda as a continuation to a Kotlin coroutine.
      final static <R extends Any> Continuation<R> with(Consumer<ContinueResult<R>> onFinished) Allows java code to provide a lambda as a continuation to a Kotlin coroutine.
      final static <R extends Any> Continuation<R> none() Allows java code to indicate they have no follow-up to a Kotlin coroutine.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait