Skip to content

Instantly share code, notes, and snippets.

View glureau-betclic's full-sized avatar
🎯
Focusing

glureau-betclic

🎯
Focusing
View GitHub Profile
@glureau-betclic
glureau-betclic / Kotlin_RxJava_Single.kt
Last active May 6, 2020 21:54
TechYourChance / Concurrency Frameworks in Android are overrated / Kotlin+RxJava
// Original code: https://www.techyourchance.com/concurrency-frameworks-overrated-android/
import io.reactivex.Single
import io.reactivex.disposables.Disposable
import io.reactivex.functions.BiFunction
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.io.File
import java.io.IOException
import java.util.concurrent.CountDownLatch
@glureau-betclic
glureau-betclic / Kotlin_RxJava.kt
Created May 6, 2020 16:10
TechYourChance / Concurrency Frameworks in Android are overrated / Kotlin+RxJava
// Original code: https://www.techyourchance.com/concurrency-frameworks-overrated-android/
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
import io.reactivex.functions.BiFunction
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.io.File
import java.io.IOException
import java.util.concurrent.CountDownLatch
fun main() {
val transformation = Transformation.TransformationComposite(listOf(Transformation.NoOpTransformation()))
println("Res: ${transformation(Shape())}")
}
class Shape
sealed class Transformation {
class NoOpTransformation : Transformation()
class TransformationComposite(val transformations: List<Transformation>) : Transformation()
package com.betclic.test
import org.junit.After
import org.junit.Before
interface Rule {
fun onBefore() {}
fun onAfter() {}
}
class MainActivity : AppCompatActivity() {
private var switchFromIoToCompute = 0L
private var switchFromComputeToIo = 0L
private var loopCount = 0L
private var appCreated = 0L
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)