Comparison between hashmap and hashtable! Connection and connections!

Source: Internet
Author: User

Comparison between hashmap and hashtable:

1. Both hashmap and hashtable are implementation classes of the map interface. hashmap removes the contains method of hashtable and changes it to containsvalue and containskey.

2. In hashmap, null can be used as a key, and there is only one such key. One or more keys can correspond to null values. Hashtable is not allowed.

3. the biggest difference is that the hashtable method is synchronize (synchronous), but hashmap is not. When multiple threads access hashtable, they do not need to implement synchronization for their own methods, hashmap must provide external synchronization for it.

Comparison between connection and connections:

1. Collections is a Java. util class that contains various static methods related to set operations.
2. collection is an interface under java. util. It is the parent interface of various collection structures.

Interface concept (interview for a person in the group: Can the interface be included ):

1. interfaces are special abstract classes. Special member methods in interfaces must be abstract methods and member variables must be constants.
The member methods in an abstract class must be abstract methods and can contain implemented member methods.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.