পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, January 19, 2017

Java.util.HashMap Class

Introduction

The java.util.HashMap class is the Hash table based implementation of the Map interface.Following are the important points about HashMap:

  • This class makes no guarantees as to the iteration order of the map; in particular, it does not guarantee that the order will remain constant over time.
  • This class permits null values and the null key.

Class declaration

Following is the declaration for java.util.HashMap class:
public class HashMap<K,V>
   extends AbstractMap<K,V>
   implements Map<K,V>, Cloneable, Serializable

Parameters

Following is the parameter for java.util.HashMap class:
  • K -- This is the type of keys maintained by this map.
  • V -- This is the type of mapped values.

Class constructors

S.N. Constructor & Description
1 HashMap()
This constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75).
2 HashMap(Collection<? extends E> c)
This constructs an empty HashMap with the specified initial capacity and the default load factor (0.75).
3 HashMap(int initialCapacity, float loadFactor)
This constructs an empty HashMap with the specified initial capacity and load factor.
4 HashMap(Map<? extends K,? extends V> m)
This constructs a new HashMap with the same mappings as the specified Map.

Class methods

S.N. Method & Description
1 void clear()
This method removes all of the mappings from this map.
2 Object clone()
This method returns a shallow copy of this HashMap instance, the keys and values themselves are not cloned.
3 boolean containsKey(Object key)
This method returns true if this map contains a mapping for the specified key.
4 boolean containsValue(Object value)
This method returns true if this map maps one or more keys to the specified value.
5 Set<Map.Entry<K,V>> entrySet()
This method returns a Set view of the mappings contained in this map.
6 V get(Object key)
This method returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
7 boolean isEmpty()
This method returns true if this map contains no key-value mapping.
8 Set<K> keySet()
This method returns a Set view of the keys contained in this map.
9 V put(K key, V value)
This method associates the specified value with the specified key in this map.
10 void putAll(Map<? extends K,? extends V> m)
This method copies all of the mappings from the specified map to this map.
11 V remove(Object key)
This method removes the mapping for the specified key from this map if present.
12 int size()
This method returns the number of key-value mappings in this map.
13 Collection<V> values()
This method returns a Collection view of the values contained in this map.

Methods inherited

This class inherits methods from the following classes:
  • java.util.AbstractMap
  • java.util.Object
  • java.util.Map

No comments:

Post a Comment