I have an extra ordinary requirement of having a Java object array list (or list initialized as an ArrayList) which will be continuously updated and is supposed to hold only the latest 5 items with the objects to be sorted in a descending order of they were added.
How could this be accomplished? I need to come up with a solution within Java SE 7 preferably using no 3rd party library.
NOTE For those who mark this question as a duplicate, you do not seem to understand the requirement of using ArrayList for this case and that Queues and ArrayLists are different object types as well as Java and C# are different languages. Do you think Stackoverflow's internal search engine is not as good as you are in locating the duplicate questions?
When marking a question as "duplicate", make sure you link a true duplicate, please.