JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label map. Show all posts
Showing posts with label map. Show all posts

what is hashmap in java collection tuorial

2:06 AM
HashMap in java with examples HashMap in java is most common Collection which we use nowadays. It stores entry in key-value pair. 1.      HashMap implements Map interface which maps key to value. 2.      It is not synchronized and is not thread safe. 3.      Duplicate keys are not allowed 4.      One null key and multiple null values are allowed 1 2 3 4 5 HashMap<Integer,String> employeeHashmap=new HashMap<Integer,String>(); employeeHashmap.put(1,"Arpit"); employeeHashmap.put(2,"John"); Example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 package org.arpit.java2blog; import java.util.HashMap; public class HashMapBuiltMain {             public static void main(String[] args) {                         HashMap<Integer, String> employeeHashmap = new HashMap<Integer, String>();  

.