I think it would be fun if Containers would be standard Java Collections. Sorting, filtering, rotating… would be very easy done by standard Java Collections operations. I can imagine a nice Collection decorated with a handfull of usefull
List Lambdas. In fact a container is nothing more than a vaadin specific implementation of a typed Collection.
I think that the Container interface is already richer than simple Collection, with the itemIds and container properties and so on. Unless the Container would be a Collection of itemIds, extending the Collection interface would add a lot of methods to implement. It is obvious though that most of them would be one-liners.
As for Java operations you mentioned, they would work fine only on small to medium sized containers. For large collections the memory use would be significantly larger, even when holding only itemIds in memory. I’m afraid that Container which is a Collection would encourage users to treat them as Collections in such memory-inefficient scenarios.
If the things I mentioned would not be a problem, you can always create a wrapper class for a Container that would implement Collection, either of itemIds or even Items. Beware though that sorting requires a List, which in its interface is closer to the Container.Indexed than to plain Container.
For me one reason for an API is to hide complexity behind simple and well known structures.
Of course i will encourage users to treat this container like a simple list. It should be possible to work
with a container without vaadin specific knowledge. For me a container is a lot of one kind with the abillity to get used
by vaadin widgets. Whats the reason for making this idea of lists to something framework specific i have to learn and understand before i can use it?
As for the effiency; If this container will be efficent or not depends on how its implemented.
As for the API, you are right - it should hide complexity. My concerns come from the fact that in my use cases almost all of the containers could contain over 100000 items and were always backed by a database. In such cases sorting them like a typical List would be a performance and memory overkill.