I have a few optional fields with String and Long values:
Optional<Long> id;
Optional<String> name;
Optional<String> lastname;
Optional<Long> number;
....
I would like to return a List with containing all the values. If, for example, the optional "name" is missing, you should save an empty string. The result of the method should be a List with eq values: "1", "John", "," 5 ".
I created a thread:
Stream fields = Stream.of(id, name, lastname, number);
But I have no idea what's next.
Sincerely.
source
share