I struggle with finding an elegant way to convert a variable of type Optional<String[]> to Optional<String> and joining all elements of the given array.
Is there an elegant solution for this?
Optional<String[]> given = Optional.ofNullable(new String[]{"a", "b"});
Optional<String> joinedString = ....;
Assertions.assertThat(joinedString.get()).isEqualTo("ab");