Introducing Swift Collections

I wouldn't say that it is equally useful, given that many methods would require you to drop the non-empty guarantee (e.g. anything that returns a subsequence or can remove elements) and the only upside seems to be that it would remove optionality from a small number of return types (first, popFirst, randomElement, min, max). It's roughly like trying to represent a non-zero number in the type system so you can't divide by zero.

1 Like