java - Is hashMap implemented as an array of linked lists -


while reading hashmap see implemented array of buckets? these buckets linked lists? if so, why called buckets , not linked lists?

looking @ source code of hashmap tells it's implemented array of entries:

transient entry[] table; 

each entry has field next, create single linked list structure:

static class entry<k,v> implements map.entry<k,v> {     final k key;     v value;     entry<k,v> next; 

"bucket" higher-level term, using in literature , when explaining hash maps. here "buckets" implemented single linked lists.


Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

php - Retrieving data submitted with Yii's CActiveForm -

fatal error - Android RunTimeError: Java.lang.RunTimeException: Unable to Instantiate activity -