Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how do i convert this kotlin code to java

Here is a Piece of code in kotlin:

val paymentConnection = payment.connect {
  connectionSucceed {
        ...
  }
  connectionFailed { throwable ->
        ...
  }
  disconnected {
        ...
  }
}

how can i convert it to Java?
the prototype in java is shown like this:

@NotNull 
public final poolakey.Connection connect(@NotNull kotlin.jvm.functions.Function1<? super poolakey.callback.ConnectionCallback,kotlin.Unit> callback)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

PaymentConnection paymentConnection = payment.connect(new ConnectionCallback() {
  @Override
  public void connectionSucceeded() { }

  @Override
  public void connectionFailed(Throwable throwable) {  }

  @Override
  public void disconnected() { }
});
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading