I have this method and I imagine if there is better way to write it (like in functional programming/streams/optional mapping)? These if else doesn\'t look good.
p