Simple mapper utilities for java projects.
Receives a value of some type A
, executes a method that returns a instance of B
.
Example:
- Receives a value
1
of typeInteger
. - Receives a function
String.valueOf
that converts theInteger
to aString
value. - The final result will be
1
as type ofString
String mapped = new Mapped<>( 1 ).to( integer -> Optional.of( String.valueOf( integer ) ) );
Assert.assertThat( mapped, equalTo( "1" ) );