Why is iterating through buckets in LinkedHashMap faster than HashMap?

I understand a lot to figure this out.

Google i found

"The HashMap iterator needs to sort through all buckets, including empty buckets."

and

"in LinkedHashMap all entries are double linked."

If so, why should the only HashMap iterate over empty buckets, but not LinkedHashMap, although both were implemented using the same bucket concept? All records have a double bond in the sense of "all buckets and elements are double connected" or only "elements are connected twice."

Please provide me with a diagram explaining the implementation of dual row buckets in LinkedHashMap.

Thank you very much in advance.

+4
2

LinkedHashMap () (before, after) .

, .

Map<Integer, String> linkedHashMap = new LinkedHashMap<Integer, String>();

LinkedHashMap with no data

.

linkedHashMap.put(1, "obj1");

linkedHashMap.put (1, "obj1"); LinkedHashMap before, after .

, .

linkedHashMap.put(15, "obj15");

linkedHashMap.put (15, "obj15");

.

linkedHashMap.put(4, "obj4");

linkedHashMap.put (4, "obj4");

next entry, SingleLikedList, โ€‹โ€‹ .

+11

LinkedHashMap , (, ) , . , LinkedHashMap .

" ": HashMap -, LinkedHashMap -, ; , -, .

LinkedHashMap , ( -, HashMap, LinkedHashMap), .

+3

All Articles