Core Java Tutorials


Introduction

Java Hello World

Java Compilation

JDK New Features

JVM Architecture

Java OOPs Concepts

Java Package

Array

Exception Handling

String

Immutable Class

File Handling

Serialization

MultiThreading

Volatile

Concurrent Package

Collection

Collection Internal

Generics

Cloning

Reflection In Java

Annotation

Class Loader

Java Inner classes

Garbage Collector

JDBC

References In Java

Heap Dump & Thread Dump

Map interface in Java

Map is a fundamental and widely-used collection type in the Java Collections Framework. Map takes key value pairs as an element. as shown in diagram Map is an interface in java which contains following common features for it's keys

It does not allow duplicate keys.
Keys are not ordered(not orders them by their insertion order (index)). .
It's default capacity is 16
It uses hashCode for it's keys.
It is good for searching and Adding,remove , size the element as per it's keys since it;s time complexity is O(1)(constant time).

Collection class Hierarchy:


Implementation of Map interface:

  HashMap.
  LinkedHashMap
 TreeMap
 Hashtable
 Properties
 ConcurrentHashMap

 Map internally uses hash code for it's keys so we must override hashCode() & equals() method inside the class which objects are used in Set.