default <B> Codec<B, G> map(final Function<? super T, ? extends B> mapper) {
		requireNonNull(mapper);

		return Codec.of(
			encoding(),
			mapper.compose(decoder())
		);
	}
Create a new {@code Codec} with the mapped result type. The following
example creates a double codec whose values are not uniformly distributed
between {@code [0..1)}. Instead, the values now follow an exponential
function.
{@snippet lang="java":
 final Codec<Double, DoubleGene> c = Codecs.ofScalar(DoubleRange.of(0, 1))
     .map(Math::exp);
}

This method can also be used for creating non-trivial codes like split
ranges, as shown in the following example, where only values between
<em>[0, 2)</em> and <em>[8, 10)</em> are valid.
<pre>{@code
  +--+--+--+--+--+--+--+--+--+--+
  |  |  |  |  |  |  |  |  |  |  |
  0  1  2  3  4  5  6  7  8  9  10
  |-----|xxxxxxxxxxxxxxxxx|-----|
     ^  |llllllll|rrrrrrrr|  ^
     |       |        |      |
     +-------+        +------+
}</pre>

{@snippet lang="java":
final Codec<Double, DoubleGene> codec = Codecs
    .ofScalar(DoubleRange.of(0, 10))
    .map(v -> {
            if (v >= 2 && v < 8) {
                return v < 5 ? ((v - 2)/3)*2 : ((8 - v)/3)*2 + 8;
            }
            return v;
        });
}

@since 4.0

@see InvertibleCodec#map(Function, Function)

@param mapper the mapper function
@param <B> the new argument type of the given problem
@return a new {@code Codec} with the mapped result type
@throws NullPointerException if the mapper is {@code null}.
jenetics/src/main/java/io/jenetics/engine/Codec.java