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
1of typeInteger. - Receives a function
String.valueOfthat converts theIntegerto aStringvalue. - The final result will be
1as type ofString
String mapped = new Mapped<>( 1 ).to( integer -> Optional.of( String.valueOf( integer ) ) );
Assert.assertThat( mapped, equalTo( "1" ) );