Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the 't' in Hash Table(Hashtable) in Java not capitalized [closed]

Everything in Java seems to follow capitalization rules except for Hashtable.

Hashtable<String, String> ht = new Hashtable<String, String>();

as opposed to

ArrayList<String> a = new ArrayList<String>();

or

HashMap<String,Integer> a = new HashMap<String,Integer>(); 

Why is this ? Is Hash Table read as just one word (Hashtable) ?

like image 779
Vrashabh Irde Avatar asked Sep 20 '12 05:09

Vrashabh Irde


2 Answers

Hashtable was created in Java v1. The consistent naming conventions for collections were established later, in Java2, when the other classes were published as part of the brand new Java Collection Framework.

Which btw made Hashtable obsolete, so it should not be used in new code.

Hope that helps.

like image 192
Bagira Avatar answered Oct 29 '22 22:10

Bagira


Although this question has no technical value, I have to admit, I've asked myself this a couple of times :)

My version is that unlike List (ArrayList), Set (HashSet) , Map (Tree/HashMap) table is not a data structure.

Of course (its possibly known) that the Hashtable class was created before the collection framework (in java 1.0). So maybe at that point they didn't really thought about the same naming conventions. In general we better use collection framework from java 2+ :)

like image 28
Mark Bramnik Avatar answered Oct 29 '22 23:10

Mark Bramnik