Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Hashmap

alpesh.prajapati00's picture

hashmap

how to compare hashmap with single character,,,...!!!!
0
Your rating: None
manuram's picture

java

i want to override two methods from hashmap class to their extended class
0
Your rating: None
chris_lab's picture

HashMap nad Methods

Hi I have a file customer.txt and it contains details of the customer.

in my programme i have an abstract class caled Customer which is extended by two subclasses OnlineCustomer and IndoorCustomer.

What i need to do is read the content of the file and store it in a HashMap. i need to use a method as the value of the HashMap

something like
0
Your rating: None
Andr's picture

Java HashMap Example

1.8
Your rating: None Average: 1.8 (5 votes)
  1. import java.util.HashMap;
  2.  
  3. public class HashMapExample{
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         HashMap myMap = new HashMap();
  8.  
  9.         map.put("1", "A");
  10.         map.put("2", "B");
  11.         map.put("3", "C");
  12.  
  13.         String one = (String) map.get("1");
  14.         System.out.println(one);
  15.     }
Andr's picture

Java HashMap Java Hashtable Difference

4.5
Your rating: None Average: 4.5 (2 votes)
Java Hashtable and Java HashMap difference

1) Hashtable does not permit null keys while HashMap allows both null keys and values.

2) Hashtable is synchronized, while HashMap is not. If we need to synchronize it, we have to do it externally.

3) HashMaps work with Iterators where the older Hashtables work with Enumerations
Andr's picture

Java HashMap Operations

1.8
Your rating: None Average: 1.8 (5 votes)
Java HashMap Other operations

void putAll(Map map)
Copies all mappings from the map to current HashMap and replaces existing entries, if any.

Void clear()
Removes all mappings from HashMap.

Collection values()
Returns collection of the values contained in the HashMap.

Set entrySet()
Andr's picture

Java HashMap Methods

3.5
Your rating: None Average: 3.5 (2 votes)
HashMap Basic methods

Object get (Object key)
Returns the value mapped to the specified key, or null if no entry is found.

Object put (Object key, Object value)
Andr's picture

HashMap Constructor

0
Your rating: None
HahaMap Constructors

HashMap ()
Constructs empty HashMap with a default initial capacity 11 and load factor 0.75.

HashMap (int initialCapacity)
Constructs empty HashMap with the specified initial capacity and default load factor 0.75.

HashMap (int initialCapacity, float loadFactor)
Andr's picture

HashMap, Java HashMap Tutorial

3.166665
Your rating: None Average: 3.2 (6 votes)
Java Hashmap

A collection allows a group of objects to be treated as a single unit. Map is one of the core interfaces of java collection framework that defines operations for maintaining mappings of keys to values.
Steven's picture

Hashmap get key

How to get key from hashmap object? I have a hashmap which contains key value pairs and I want to get a particular key from my object. Is it possible to get key from Hashmap object?
4
Your rating: None Average: 4 (1 vote)
Syndicate content