How would you implement the universal MruList with limited features in C # or Java?
I want to have a class representing the most used cache or list (= MruList). It must be general and limited by the capacity (counter) specified when creating the instance. I would like the interface to be something like:
public interface IMruList<T>
{
public T Store(T item);
public void Clear();
public void StoreRange(T[] range);
public List<T> GetList();
public T GetNext();
}
Each Store () should place an item at the top (in front?) Of the list. GetList () should return all the items in an ordered list, sorted by the last store. If I call Store () 20 times and my list lasts 10, I want to save only the 10 most recently stored items. GetList and StoreRange are designed to support finding / saving MruList when the application starts and shuts down.
This is a graphical interface support. I think I might also need to know the timestamp for the saved item. May be. Not sure.
Inside, how do you implement it and why?
(no, this is not a course assignment)
source
share