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 abstract class Response { | |
| private Response() { | |
| } | |
| // $FF: synthetic method | |
| public Response(DefaultConstructorMarker $constructor_marker) { | |
| this(); | |
| } | |
| } |
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
| sealed class Response | |
| data class Success(val body: String): Response() | |
| data class Error(val code: Int, val message: String): Response() | |
| object Timeout: Response() |
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
| import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory | |
| import io.reactivex.schedulers.Schedulers | |
| import io.reactivex.subjects.ReplaySubject | |
| import retrofit2.Retrofit | |
| import retrofit2.converter.gson.GsonConverterFactory | |
| val api: StackoverflowApi = Retrofit.Builder() | |
| .baseUrl("https://api.stackexchange.com/2.2/") | |
| .addConverterFactory(GsonConverterFactory.create()) | |
| .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) |
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
| import lombok.Data; | |
| import lombok.experimental.ExtensionMethod; | |
| @ExtensionMethod(Streams.class) | |
| public class Foo { | |
| void foo(List<Person> persons) { | |
| persons.toStream() | |
| .filter(it -> it.getAge() >= 21) | |
| .filter(it -> it.getName().startsWith("P")) | |
| .map(Person::getName) |
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
| dependencies { | |
| classpath 'me.tatarka:gradle-retrolambda:3.4.0' | |
| } | |
| apply plugin: 'me.tatarka.retrolambda' | |
| compileOptions { | |
| sourceCompatibility JavaVersion.VERSION_1_8 | |
| targetCompatibility JavaVersion.VERSION_1_8 | |
| } |
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
| button.setOnClickListener(view -> System.out.println("Hello World!")); |
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
| button.setOnClickListener { println("Hello World") } |
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
| void foo(List<Person> persons) { | |
| persons.stream() | |
| .filter(it -> it.getAge() >= 21) | |
| .filter(it -> it.getName().startsWith("P")) | |
| .map(Person::getName) | |
| .sorted() | |
| .forEach(System.out::println); | |
| } | |
| class Person { |
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
| import lombok.Data; | |
| import com.annimon.stream.Stream; | |
| void foo(List<Person> persons) { | |
| Stream.of(persons) | |
| .filter(it -> it.getAge() >= 21) | |
| .filter(it -> it.getName().startsWith("P")) | |
| .map(Person::getName) | |
| .sorted() | |
| .forEach(System.out::println); |
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
| defaultConfig { | |
| jackOptions { | |
| enabled true | |
| } | |
| } | |
| compileOptions { | |
| sourceCompatibility JavaVersion.VERSION_1_8 | |
| targetCompatibility JavaVersion.VERSION_1_8 | |
| } |