What collections extension function can I use if I want to get first element from the list and if list is empty, then run a function that creates an element and returns it?
The closest I found is
ifEmpty{}
, but it returns the entire collection if it is not empty, while I don’t need the collection and just it’s first element.