I believe OP's question is more on : why there are duplicated methods, given
isEmpty() are doing the same thing?
If you take a closer look, in
HashTable, there are more examples like this: there are methods doing similar thing but with different names.
Here is the history in brief:
At the time of JDK 1.0, there was no such thing as "Collection" framework.
HashTable were some of the basic data structures provided by Java.
Later in JDK 1.2, Collection framework was added to JDK, and standard interfaces (like
Map) were introduced.
However in these new standard collection interfaces, methods were named in a different convention. The change in naming convention was most probably influenced by Java Bean standard introduced also in JDK 1.2. These method names were different from those in old
HashTable classes. For example, it was named
empty() in original class but was named
In order to make
HashTable compatible with Collection framework,
HashTable has implemented its corresponding Collection interfaces. On the same time, old methods were kept for the sake of backward compatibility.
Hence the "duplicated" methods you see now.