Kotlin coroutine async implementation without java 8 requirement.
Kotlin
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

DEPRECATED

update for 1.1 beta 17 on the way

async-under8

Library built upon Kotlin coroutines. Forked from kotlinx.coroutines (kotlinx-coroutines-async), but drops java 8 requirement.

This modification allows libraries to use asnyc and runs under most of Android devices.

Thanks to tikurahul - kotlin-futures implementation.

Example

import async_under8.async
import com.rahulrav.futures.Future
 
private fun startLongAsyncOperation(v: Int) =
        Future.submit {
            Thread.sleep(1000)
            "Result: $v"
        }
        
fun main(args: Array<String>) {
    
    val future = async<String> {
        (1..5).map {
            await(startLongAsyncOperation(it))
        }.joinToString("\n")
    }
    
    future.onSuccess {
        println(it)
    }
}

Status

Build Status

Download

Download

or depend via Gradle:

compile 'com.fboldog.async_under8:async_under8:0.0.1'

or Gradle Kotlin Script:

compile("com.fboldog.async_under8:async_under8:0.0.1")

or Maven:

<dependency>
  <groupId>com.fboldog.async_under8</groupId>
  <artifactId>async_under8</artifactId>
  <version>0.0.1</version>
</dependency>