LinkedHashSet does not support access order because you are not accessing LinkedHashSet elements.
You add items to the LinkedHashSet , and you can LinkedHashSet over them in order of placement.
When you check if an item is a member of a LinkedHashSet , you are not accessing it. You check membership through boolean contains(Object o) , calls map.containsKey(o) for the support map. However, containsKey() does not affect the Map access order.
On the other hand, the LinkedHashMap get(Object key) LinkedHashMap affects the access order, but it is never used by LinkedHashSet .
source share