Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neutron-pro/promise-api
This api readapts the Promise javascript on java. They aim to be as similar as possible to the original ones and are also asynchronous.
https://github.com/neutron-pro/promise-api
Last synced: 14 days ago
JSON representation
This api readapts the Promise javascript on java. They aim to be as similar as possible to the original ones and are also asynchronous.
- Host: GitHub
- URL: https://github.com/neutron-pro/promise-api
- Owner: Neutron-Pro
- Created: 2022-11-09T23:47:24.000Z (about 2 years ago)
- Default Branch: develop
- Last Pushed: 2022-11-17T10:07:03.000Z (about 2 years ago)
- Last Synced: 2024-11-06T20:45:07.211Z (2 months ago)
- Language: Java
- Homepage:
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Promise API for JAVA
This api readapts the Promise javascript on java. They aim to be as similar as possible to the original ones and are also asynchronous.
## Implementation of api in your project
**Core**: https://github.com/Neutron-Pro/promise-core
```gradle
repositories {
maven { url "https://jitpack.io" }
}dependencies {
implementation 'com.github.Neutron-Pro:promise-api:{{ version }}'
}
```## Examples
For create a promise, use `fr.neutronstars.promise.api.PromiseService`.
```java
service.of(resolver -> resolver.accept("This is a test!"))
.then(System.out::println) // Output: "This is a test!"
.map(str -> 5)
.then(System.out::println) // Output: 5
.async();
``````java
int x = service.of(resolver -> resolver.accept("This is a test!"))
.then(System.out::println) // Output: "This is a test!"
.map(str -> 5)
.then(System.out::println) // Output: 5
.await();System.out.println(x); // Output: 5
```