This file contains 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
package fr.x | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.flow.flow | |
import kotlinx.coroutines.flow.flowOn | |
import kotlinx.coroutines.flow.onEach | |
import kotlinx.coroutines.runBlocking | |
import org.junit.Test |
This file contains 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
@RequiresApi(Build.VERSION_CODES.P) | |
fun StrictMode.VmPolicy.Builder.detectAllExpect(ignoredViolationPackageName: String, justVerbose: Boolean = true): StrictMode.VmPolicy.Builder { | |
return detectAll() | |
.penaltyListener(Executors.newSingleThreadExecutor(), StrictMode.OnVmViolationListener | |
{ | |
it.filter(ignoredViolationPackageName, justVerbose) | |
}) | |
} |
This file contains 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
package com.bravedroid.connecta.presentation.main | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.databinding.DataBindingUtil | |
import androidx.databinding.ViewDataBinding | |
import androidx.fragment.app.Fragment | |
import androidx.fragment.app.FragmentActivity | |
import kotlin.properties.ReadOnlyProperty |
This file contains 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
package fr.francetv.francetvsport.arch.application | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.awaitClose | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.MutableStateFlow | |
import kotlinx.coroutines.flow.channelFlow | |
import kotlinx.coroutines.flow.collect | |
fun main() = runBlocking { |
This file contains 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
package com.raywenderlich.kotlin.coroutines | |
import androidx.arch.core.executor.ArchTaskExecutor | |
import androidx.arch.core.executor.TaskExecutor | |
import androidx.lifecycle.* | |
import kotlinx.coroutines.* | |
import kotlin.coroutines.CoroutineContext | |
@ExperimentalCoroutinesApi | |
class Main3 { |
This file contains 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
package com.raywenderlich.kotlin.coroutines | |
import androidx.arch.core.executor.testing.InstantTaskExecutorRule | |
import androidx.lifecycle.* | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.test.runBlockingTest | |
import kotlinx.coroutines.test.setMain | |
import org.junit.Assert.assertEquals | |
import org.junit.Rule | |
import org.junit.Test |
This file contains 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
package fr.francetv.francetvsport.arch.presentation.videodetail | |
import kotlinx.coroutines.* | |
fun main() = runBlocking { | |
val parentJob = launch { | |
launch { | |
println("start launch child") | |
while (isActive) { | |
delay(500) |
This file contains 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 kotlinx.coroutines.async | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.runBlocking | |
fun main() { | |
runBlocking { | |
val doIt1 = doIt1() | |
val doIt2 = doIt2() | |
val doIt3 = doIt3() | |
println("result ${doIt1 + doIt2 + doIt3}") |
This file contains 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
package fr.francetv.francetvsport.arch.infrastructure.data.source.remote.pic | |
//You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. | |
fun find(integers: Array<Int>): Int { | |
var outlierInteger: Int = 0 | |
val oddIntegers = mutableListOf<Int>() | |
val evenIntegers = mutableListOf<Int>() | |
var i = 0 | |
while (i <= integers.lastIndex) { | |
val integer = integers[i] | |
if (integer.isEven()) { |
NewerOlder