java-utils-examples

This contains the example usages of Java-Utils library which is a set of Java utilities with useful helper methods and classes for Optional, Function, Stream and Tuples

License

License

Categories

Categories

Java Languages
GroupId

GroupId

org.vishag
ArtifactId

ArtifactId

java-utils-examples
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

java-utils-examples
This contains the example usages of Java-Utils library which is a set of Java utilities with useful helper methods and classes for Optional, Function, Stream and Tuples
Project URL

Project URL

https://github.com/loganathan001/Java-Utils
Source Code Management

Source Code Management

https://github.com/loganathan001/Java-Utils

Download java-utils-examples

How to add to project

<!-- https://jarcasting.com/artifacts/org.vishag/java-utils-examples/ -->
<dependency>
    <groupId>org.vishag</groupId>
    <artifactId>java-utils-examples</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.vishag/java-utils-examples/
implementation 'org.vishag:java-utils-examples:1.0.0'
// https://jarcasting.com/artifacts/org.vishag/java-utils-examples/
implementation ("org.vishag:java-utils-examples:1.0.0")
'org.vishag:java-utils-examples:jar:1.0.0'
<dependency org="org.vishag" name="java-utils-examples" rev="1.0.0">
  <artifact name="java-utils-examples" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.vishag', module='java-utils-examples', version='1.0.0')
)
libraryDependencies += "org.vishag" % "java-utils-examples" % "1.0.0"
[org.vishag/java-utils-examples "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.vishag : java-utils jar 1.0.0-SNAPSHOT

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Java-Utils v1.0.0

Maven Central Build Status Coverage Status Codacy Badge HitCount License contributions welcome

This library is a set of Java Utility containing many useful Helper Classes which are described below.

#Stream Util
This library contains the StreamUtil, that contains flatten methods to flatten any stream of optionals to the stream of the type contained in the optionals. These flatten methods also supports boxed and non-boxed types of streams.

#Optional Util
This library contains the OptionalUtil, that flattens any optional of optional of any type to an optional of the type. Optional of a non-boxed optional type can also be flattened.

#Optional with Throwable
A new OptionalWithThrowable is added so that any map/flatMap/filter/ifPresent operation will accept the corresponding 'Funtional Interface with Throwable' which are added in this Java Utlitity.

#Funtional Interfaces with Throwable
With regular Functional Interfaces, exceptions or errors are not able chain the exceptions thrown inside the method to the caller. This required to handle the exception within the method definition itself. To handle this requirement new kind of Funtional Interfaces namely PredicateWithThrowable, FuntionWithThrowable, ConsumerWithThrowable and BiFunctionWithThrowable are added. Some of these are also used with OptionalWithThrowable implementation.

#Tuples
Inspired by Scala Tuples, this Java Utility includes convinent Generic Tuples from Tuple2 to Tuple10 and a convinient helper factory called Tuples to create them.

#Mappable Optionals
This library contains Mappable counterparts of OptionalInt, OptionalLong and OptionalDouble. This Mappable versions allows us to avoid boxing of primitive data typed streams. This implementation is done because the current versions of OptionalInt, OptionalLong and OptionalDouble do not provide a map or flatMap method, which forces us to use the Boxed verison of Optional.

To install the latest version, add the below pom dependency entry:

<dependency>
  <groupId>org.vishag</groupId>
  <artifactId>java-utils</artifactId>
  <version>1.0.0</version>
</dependency>

#Examples
Added an example project that demonstrates the use of this Library.

To install the examples, add the below pom dependency entry:

<dependency>
  <groupId>org.vishag</groupId>
  <artifactId>java-utils-examples</artifactId>
  <version>1.0.0</version>
</dependency>

Also, please look into the Unit tests for all the use-cases and examples.

Versions

Version
1.0.0