Open steve-donovan opened 2 years ago
I'm happy to make the change if you agree that it should be done
Hi @steve-donovan,
in coming months, we are going to do some changes to mitigate some Code Smells
reported by Sonar.
One of them is your advice about returning a list or not return nulls.
I will maintain this issue opened.
Good review mate
Juan Antonio
Description
As an example, the FlightOfferSearch class has an array representing Stops within a Segment. If there are no stops, the array is NULL and can cause an NPE when using java streams.
Its best practice to either return an Optional or return an empty collection to guard against NPE's.
Steps to Reproduce
Expected Behavior: Collections with no data should be empty, not NULL
Actual Behavior: Collections such as Stops have a NULL assignment, causing NPE when streaming is applied.
Stable Behavior? 100%