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
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 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
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 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
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 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
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 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
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 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
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 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 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 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
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()) { |
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
package fr.francetv.francetvsport.arch.infrastructure.data.source.remote.pic | |
//Your task is to split the chocolate bar of given dimension n x m into small squares. | |
//Each square is of size 1x1 and unbreakable. Implement a function that will return minimum number of breaks needed. | |
// | |
//For example, if you are given a chocolate bar of size 2 x 1 you can split it to single squares in just one break, but for size 3 x 1 you must perform two breaks. | |
// | |
//If input data is invalid you should return 0 (as in no breaks are needed if we do not have any chocolate to split). Input will always be a non-negative integer. | |
fun breakChocolate(n: Int, m: Int): Int = if ((n in 0..1) && (m in 0..1)) { | |
0 |
NewerOlder