I know how to limit size in Map (like this,using LinkedHashMap.removeEldestEntry method does exactly that)
I want to know how to limit size in a List,what is a best way to implement?
thanks for help :)
I know how to limit size in Map (like this,using LinkedHashMap.removeEldestEntry method does exactly that)
I want to know how to limit size in a List,what is a best way to implement?
thanks for help :)
I would look at the java.util.Collections class source and develop a SizeLimitedList similar to how they do a checkedList. Then on add I would delete the first entry from the list if the list was full.