A DESCRIPTION OF THE REQUEST :
Linked hashmap is described in the documentation as "Hash table and linked list implementation of the Map interface" but there is no way to view a linked hashmap as a list of entries.
The linked hashmap implementation use linked list, but there is no easy way to view it as a list. So if you use a third party code that need list, the simple
way to do this actually is to use a temporary list.
In swing application, the use temporary list breaks the design pattern MVC and transform the simple fact to view (on screen) a linked hash map into a JList
in a nightmare.
Another justification, there is no way to iterate on entries in backward order even if the current implementation permit this.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Add a method entryList() in the LinkedHashMap class.
proposed signature :
public List<Map.Entry<K,V>> entryList();
the returned List may implements SequentialList.
To be symetric, a method entryList() could be added to LinkedHashSet
public List<E> asList();
view as an entry list :
LinkedHashMap<String,String> map=new LinkedHashMap<String,String>();
###@###.### 10/21/04 23:29 GMT