Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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.0

run.smt.f
functional
1.1.0

run.smt.f
predicate
1.1.0

run.smt.f
predef
1.1.0

```