Some people say Java evolves slowly. I say, we got collections in 1998 and 💥 25 years later we (probably) get `List::getFirst` and `getLast`. 😁 But also a way for easy reverse iteration/streaming. Let's have a look! 🧵 (If you prefer video: youtube.com/watch?v=xBBuSh…)
In Java collections, there's the concept of "encounter order", which means that if a collection isn't changed, every iteration is guaranteed to show the same elements in the same order. All `List`s have that property, but `Set`s generally don't. `SortedSet`s on the other hand do.
But encounter order is just documentation - you can't find it in the API. And when you want to get the first/last element or iterate/stream in reverse order, you feel the pain - something with encounter order should make that easy - but it's not. That's about to change!
Because @stuartmarks wants to introduce sequenced collections - not just a concept, but three types: * `SequencedCollection` * `SequencedSet` * `SequencedMap` They come with get/add/remove first/last methods as well as `reversed()`, which returns a view with reversed order.