Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saksmt/f
Provides some useful (especially for method references) functional methods for Java 8
https://github.com/saksmt/f
functional-programming java java-8 lambda stream
Last synced: about 1 month ago
JSON representation
Provides some useful (especially for method references) functional methods for Java 8
- Host: GitHub
- URL: https://github.com/saksmt/f
- Owner: saksmt
- Created: 2016-04-09T14:25:05.000Z (over 8 years ago)
- Default Branch: develop
- Last Pushed: 2016-05-04T15:51:10.000Z (over 8 years ago)
- Last Synced: 2024-09-29T23:05:41.259Z (about 2 months ago)
- Topics: functional-programming, java, java-8, lambda, stream
- Language: Java
- Size: 51.8 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# f
Provides some useful (especially for method references) functional methods for Java 8
## Example
```java
import static run.smt.f.functional.Pipes.*;
import static run.smt.f.functional.signaturemanip.ArgumentManipulation.*;
import static run.smt.f.functional.signaturemanip.ReturnManipulation.*;
import static run.smt.f.predef.LogicChecks.*;
import static run.smt.f.predef.LogicOperator.*;class Example {
public void usage() {
getSomeStream()
.filter(and(this::isUseful, this::isGood))
.filter(not(this::isWrong))
.filter(isNotNull())
.map(pipe(bind(this::convertToPojo, getArg()), Pojo::getField))
.foreach(expand(this::dontNeedArgs));
}private Stream getSomeStream() {}
private boolean isUseful(Object elem) {}
private boolean isGood(Object elem) {}
private boolean isWrong(Object elem) {}
private Arg getArg() {}
private Pojo convertToPojoWithArg(Arg arg, Object elem) {}
private void dontNeedArgs() {}}
```## Modules
- `definition` - Definition of functional interfaces
- `functional` - Wrapper for easier usage with method references, contains all methods of functional interfaces as static methods
- `predicate` - Definition of predicates, extended methods in functional interfaces for easier usage with functions returning boolean values
- `predef` - Predefined operations and checks for both simple functional interfaces from `definition` and `predicate`
- `all` - Parent module for all listed above## Download
```xml
run.smt.f
definition
1.1.0run.smt.f
functional
1.1.0run.smt.f
predicate
1.1.0run.smt.f
predef
1.1.0```