Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/krkarma777/javacoroutines

A Java library to implement coroutine-like functionality with @Suspend annotation, inspired by Kotlin's suspend functions.
https://github.com/krkarma777/javacoroutines

annotation-based-library asynchronous concurrency coroutines java kotlin-inspired non-blocking

Last synced: 3 days ago
JSON representation

A Java library to implement coroutine-like functionality with @Suspend annotation, inspired by Kotlin's suspend functions.

Awesome Lists containing this project

README

        

# JavaCoroutines

**JavaCoroutines** is a Java library that introduces coroutine-like functionality using the `@Suspend` annotation, inspired by Kotlin's `suspend` functions. This library allows you to write asynchronous and non-blocking code in Java with a similar approach to Kotlin coroutines.

## Features

- Simple `@Suspend` annotation to mark coroutine methods.
- Coroutine manager to handle coroutine execution and state management.
- Lightweight and easy to integrate into existing Java projects.

## Getting Started

### Installation

Add the following dependency to your `build.gradle` file:

```gradle
dependencies {
implementation 'com.coroutines:java-coroutines:1.0-SNAPSHOT'
}
```

### Usage

To use JavaCoroutines, simply annotate your methods with `@Suspend` and manage coroutines using the provided coroutine manager. Here is a basic example:

```java
import com.coroutines.Suspend;

public class Example {
@Suspend
public void asyncMethod() {
// Your asynchronous code here
}

public static void main(String[] args) {
Example example = new Example();
CoroutineManager manager = new CoroutineManager();
manager.run(example::asyncMethod);
}
}
```

## Contributing

We welcome contributions of all kinds, including code, documentation, bug reports, and feature requests. Please read our [Contributing Guide](CONTRIBUTING.md) for more information.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.