Linked Questions

22 votes
3 answers
2k views

How is Hashtable different to Hashmap [duplicate]

Possible Duplicate: Differences between HashMap and Hashtable? I've seen hash tables and hash maps used in different code but they look like they do the same thing. Is there a difference between ...
user1813746's user avatar
5 votes
5 answers
3k views

difference between hashmap and hashtable| [duplicate]

Possible Duplicate: Differences between HashMap and Hashtable? I went to an interview the other day interviewer asked me under which situation will there be a problem to use hashmap rather then ...
Akshay's user avatar
  • 2,597
2 votes
6 answers
2k views

Java hashtable or hashmap? [duplicate]

I've been researching to find a faster alternative to list. In an algorithm book, hashtable seems to be the fastest using separate chaining. Then I found that java has an implementation of hashtable ...
WhatIf's user avatar
  • 653
3 votes
0 answers
1k views

ConcurrentHashMap and Hash table difference [duplicate]

I am new to Java and stackoverflow and am seeking answer from experienced folks, who have worked on Collections Framework. I read that hashTable is thread safe and so is concurrentHashMap, but a ...
Karan's user avatar
  • 2,140
1 vote
0 answers
396 views

HashMap vs Hashtable (get & put) Implementation [duplicate]

I've been going through Java API java.util.HashMap and java.util.Hashtable I've understood the internal implementation of get(Key k) and put(Key k, Value v)methods of HashMap, and Hashtableseems ...
inityk's user avatar
  • 486
1159 votes
18 answers
600k views

What does 'synchronized' mean?

I have some questions regarding the usage and significance of the synchronized keyword. What is the significance of the synchronized keyword? When should methods be synchronized? What does it mean ...
Johanna's user avatar
  • 27.7k
624 votes
11 answers
451k views

Java Class that implements Map and keeps insertion order?

I'm looking for a class in java that has key-value association, but without using hashes. Here is what I'm currently doing: Add values to a Hashtable. Get an iterator for the Hashtable.entrySet(). ...
Shane's user avatar
  • 6,325
299 votes
9 answers
206k views

Java List.add() UnsupportedOperationException

I try to add objects to a List<String> instance but it throws an UnsupportedOperationException. Does anyone know why? My Java code: String[] membersArray = request.getParameterValues('members')...
Florian Ajir's user avatar
  • 4,414
131 votes
20 answers
140k views

When to use Comparable and Comparator

I have a list of objects I need to sort on a field, say Score. Without giving much thought I wrote a new class that implements Comparator, that does the task and it works. Now looking back at this, ...
pkrish's user avatar
  • 2,369
140 votes
14 answers
373k views

Java: how to convert HashMap<String, Object> to array

I need to convert a HashMap<String, Object> to an array; could anyone show me how it's done?
burntsugar's user avatar
  • 58.2k
112 votes
7 answers
183k views

Difference between Dictionary and Hashtable [duplicate]

Possible Duplicate: Why is Dictionary preferred over Hashtable in C#? What is the difference between Dictionary and Hashtable. How to decide which one to use?
blitzkriegz's user avatar
  • 9,616
120 votes
6 answers
41k views

HashMap Java 8 implementation

As per the following link document: Java HashMap Implementation I'm confused with the implementation of HashMap (or rather, an enhancement in HashMap). My queries are: Firstly static final int ...
Hasnain Ali Bohra's user avatar
85 votes
13 answers
87k views

Simplest and understandable example of volatile keyword in Java

I'm reading about volatile keyword in Java and completely understand the theory part of it. But, what I'm searching for is, a good case example, which shows what would happen if variable wasn't ...
tmgr's user avatar
  • 1,187
94 votes
2 answers
105k views

ConcurrentHashMap and Hashtable in Java [duplicate]

What is the difference between a ConcurrentHashMap and a Hashtable in Java? Which is more efficient for threaded applications?
sheidaei's user avatar
  • 10.4k
54 votes
6 answers
28k views

Difference between Hashtable and Collections.synchronizedMap(HashMap)

As far as I know, java.util.Hashtable synchronizes each and every method in the java.util.Map interface, while Collections.synchronizedMap(hash_map) returns a wrapper object containing synchronized ...
Vinoth Kumar C M's user avatar

15 30 50 per page
1
2 3 4 5
7