Which collection type in java should I use if I want to have something like Size-limited queue that holds last N elements in Java.
I have a list and I want to limit the size of the list to "100". So if i add the 101 th element in the list, the first element should be deleted automatically (FIFO). For example:
List<Item> items = ??;
items.add(item_1);
...
items.add(item_101); // implicitly calls items.remove(0);
items.add(item_102); // implicitly calls items.remove(0);