I want to delete the oldest member of Is there no way override I know that I have one deleted entry entry method override This statement is incorrect because You can use (though not well known), method: This is how your custom LinkedHashSet , I know that a
The oldest entry method which I want to override (), but I think I have to define the
initial capability and
load factor which I do not care about And I just want to delete the element which was recently used (even on the basis of access i mean
Put when it is already in the set or is reading)
removeEldestEntry ?
LinkedHashSet has-A
LinkedHashMap is no more -A
set & lt; String & gt; MySet = Collections.newSetFromMap (New Linkedhep & lt; String, Boolean & gt; () Remove the protected Boolean Extra Large Entry (Map. Entry & lt; String, Boolean & gt; largest) {Return size ()> MAX_ENTRIES ;}});
removeEldestEntry link one
linked (a set-similar interface) Code> Method
MAX_ENTRIES Being a custom static that you define.
No comments:
Post a Comment