Last active
November 27, 2017 08:59
-
-
Save sliskiCode/8ba139d23a7bfe67edc24d2e84103327 to your computer and use it in GitHub Desktop.
6 magic sugars that can make your Kotlin codebase happier #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final void sugar(@NotNull Response response) { | |
Intrinsics.checkParameterIsNotNull(response, "response"); | |
String var3; | |
if (response instanceof Success) { | |
var3 = ((Success)response).getBody(); | |
System.out.println(var3); | |
} else if (response instanceof Error) { | |
var3 = "" + ((Error)response).getCode() + ' ' + ((Error)response).getMessage(); | |
System.out.println(var3); | |
} else { | |
if (!Intrinsics.areEqual(response, Timeout.INSTANCE)) { | |
throw new NoWhenBranchMatchedException(); | |
} | |
var3 = response.getClass().getSimpleName(); | |
System.out.println(var3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment