Quantcast
Viewing latest article 24
Browse Latest Browse All 484

Answer by Federico klez Culloca for How to turn a optional of an string array into a optional of a string?

Looks to me like a simple map operation with String.join().

Optional<String[]> given = Optional.ofNullable(new String[]{"a", "b"});var joinedString = given.map(s -> String.join("", s));System.out.println(joinedString.get()); // prints "ab"

Viewing latest article 24
Browse Latest Browse All 484

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>