FunctionalJ ▲
FunctionalJ is a library for writing functional style code in Java. It aims be a practical expansion to functional programming added in Java 8. FunctionalJ is a pure Java library with all code written in Java so its usages will be just like other Java library. No additional build steps or tools are required outside of adding dependencies.
- Functions!!! More functions and ways use them ▲
- Accesses and Lenses ▲
- Lazy functional list and map ▲
- Addition to Stream and Iterator ▲
- Pipeable (flow) and PipeLine (point-free style of programming) ▲
- Result ▲
- Struct type - an immutable data with build-in lens and exhaustive builder ▲
- Choice type - a sum type with payload and pattern matching ▲
- Rule type to constrain existing types. ▲
- Ref for implicit context and dependency injection ▲
- DeferAction, Promise and IO for side effect management ▲
- Event (Work in progress) ▲
See some examples in the example project here or functionaj.io.
Articles
- Introducing FunctionalJ.io
- Setup FunctionalJ for Eclipse
- Immutable Data With FunctionalJ.io
- Choice Types in Java With FunctionalJ.io
- Lazy-Evaluated Functional Lists
- Introduction to FunctionalJ.io
- Setup Eclipse for FunctionalJ
- Immutable Data with FunctionalJ.io
- Choice Types in Java with FunctionalJ.io
This project binary is published on my maven repo hosted on GitHub. So to use FunctionalJ you will need to ...
Add the dependencies to FunctionalJ.
compile 'io.functionalj:functionalj-all:0.5.5.0' // Please lookup for the latest version.
annotationProcessor 'io.functionalj:functionalj-types:0.5.5.0' // Please lookup for the latest version.
UseFunctionalJGradle is an example project that use FunctionalJ. You can use that as a starting point.
Add the dependencies to FunctionalJ.
<dependency>
<groupId>io.functionalj</groupId>
<artifactId>functionalj-all</artifactId>
<version>0.5.5.0</version>
</dependency>
UseFunctionalJMaven is an example project that use FunctionalJ. You can use that as a starting point.
This project is developed as a gradle project on Eclipse
so you can just clone and import it to your Eclipse.
Although, never tried, but I think it should be easy to import into IntelliJ.
Simply run gradle clean build
to build the project (or use the build-in gradle wrapper).
This project is build with Java 8 and make heavy use of Lombok val
for type inference.
This library works within the boundary of the language though pushing to the edge in some aspect. Therefore, it sometimes breaks coding convention. I would ask if you could look over this and see if this library can bring you any benefits.
This project use a modified semantic versioning. Well, the last three digits are kind of semantic version. But the first one represents a conceptual version of the library. This is done this way as it was found that the version was updates too quickly and there is nothing indicates the fundamental change in concept or philosophy of the library.
- The first digit is the version of the concept - changed when there is a big changes across the library or in the fundamental ways and will reset the second digit.
- The second digit is the version of the API - changed when there is a breaking changes in the API.
- The third digit is the version of the implementation.
- The forth digit is the version of correction.
Please use our issues tracking page to report any issues.
You can import and use this library as you needed. But if you just need a small part of it, feel free to fork it or just copy the part that you need. :-)
Feel free to join in. Report problems, suggest solutions, suggest more functionalities, making pull requests ... anything is appreciated (please do it in issues tracking page or email me directly).
If this is useful to you and want to buy me a coffee or lunch or help with my kids college fund ... that would be great :-p