Transferred from:
Http://blog.csdn.net/wl_ldy/article/details/5941770
Hashtable is widely used. hashmap is a class used to replace hashtable in the new framework. In other words, hashmap is recommended instead of hashtable. Maybe you think
First of all, Hashmap,hashmap is a class, and all classes in Java inherit from an object class. The Hashcode () method is defined in the object class, in other words, any class will have this hashcode () method.So the Key.hashcode () function calls
Java Basics Tutorial: Hashtable vs. HashMap 1. Some of the arguments about HashMap:A) HashMap is actually a "chain-table hash" of the data structure, that is, the combination of arrays and linked lists. the underlying structure of the HASHMAP is an
class inheritance and implementation look up Public class Hashtable extends Dictionary Implements Map, Cloneable, java.io.Serializable Public class HashMap extends Abstractmap Implements Map, Cloneable, Serializable
What is Hashtable?
Hashtable is a synchronous implementation of map interface based on hash table
The key of the element in the Hashtable is unique, and the value can be repeated
The key and value of the elements in the Hashtable
Source: http://www.cnblogs.com/devinzhang/archive/2012/01/13/2321481.html1. HashMap1) data structure of HashMapHashMap is a combination of arrays and linked lists (in the data structure called "chain-Table hashing"), as shown in:When we put the
Python Loop data is simple
The code is as follows
Copy Code
For I in Range (0,10):
G_list (i) indicates that from 0 to 10
It's easy to read.
Loop array
The code is as follows
Copy Code
one. DataType (data type ):Perl's data types are roughly four: Scalar (variables), Scalar Array (array), hash array (hash), References (pointer), but they seem to be small but more than sufficient. In particular, you can write a Perl program without
The HashMap and Hashtable two classes implement the map interface, which holds the k-v pair (Key-value pair), and HashSet implements the set interface, which is similar in nature to a collection.Hashtable and HashMap differencesfirst, the inherited
Bkdrhash is a word hash algorithm, like Bkdrhash,aphash,djbhash,jshash,rshash,sdbmhash,pjwhash,elfhash and so on, these are more classic, through HTTP// blog.csdn.net/wanglx_/article/details/40300363 (string hash function) In this article, we know
List: (ordered, can be repeated) by subscript index----ArrayList variable array, randomly find----linkedlist linked list, any position insertion delete fast----Vector efficiency is lower than ArrayList, but can be used for multi-threaded
The HashMap and Hashtable two classes implement the map interface, which holds the k-v pair (Key-value pair), and HashSet implements the set interface, which is similar in nature to a setHashtable and HashMap differencesFirst, the inherited parent
The difference between Hashtable and HashMap
First, the inherited parent classes are different.Hashtable inherits from the dictionary class, and HashMap inherits from the Abstractmap class. But both implement the map interface.
Copy Code code
First, String,stringbuffer, StringBuilder is what the difference is. Why the string is immutable.
A: 1, string is a literal constant, StringBuffer and StringBuilder are string variables. The character content of the latter two is variable, and the
1. Map systemReference: http://java.chinaitlab.com/line/914247.htmlHashtable is a built-in implementation of the map's unique thread safety prior to JDK 5 (Collections.synchronizedmap does not count). Hashtable inherits Dictionary (Hashtable is its
The following is the time to meet the interview problems to organize, to share with you for your reference, the specific content as follows
Java Basics:
1, the reason for the memory leakage
1), resource object not closed.such as cursor, file and
the difference between HashMap and Hashtable
1.HashTable method is synchronous, HashMap is not synchronized, so in multi-threaded occasions to do hands-on synchronization hashmap This difference is like vector and ArrayList.
2.HashTable does not
1, inheritance and implementation of the difference Hashtable is based on the old dictionary class, complete the map interface; HashMap is an implementation of the map interface introduced by Java 1.2 (HashMap inherited from Abstractmap,
> Answers attached to questions
1. JUnit usage, before, beforeclass, after, and afterclass execution sequence
2. Distributed locks
3. How to configure the weight-based forwarding for nginx request forwarding algorithm
4. What is the problem with
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.