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 List with contains all of the values. If e.g optional "name" is no present, should be stored empty String. Result of method should be List with values e.q: "1", "John", "", "5".
I made stream:
Stream fields = Stream.of(id, name, lastname, number);
But I have no idea what next.
Regards.