background preloader

Java.util.*

Facebook Twitter

Java - When to use LinkedList<> over ArrayList<> Hash Tables in Java LG #57. "Linux Gazette...making Linux just a little more fun! " By Ben Tindale A hash table is conceptually a contiguous section of memory with a number of addressable elements, commonly called bins, in which data can be quickly inserted, deleted and found. Hash tables represent a sacrifice of memory for the sake of speed - they are certainly not the most memory efficient means of storing data, but they provide very fast lookup times. Hash tables are a common means of organising data, so the designers of the Java programming language have provided a number of classes for easily creating and manipulating instances of hash tables.

Hashtable is the class which provides hash tables in Java. A key is a value that can be mapped to one of the addressable elements of the hash table. String abc = new String("abc"); System.out.println("Key for \"abc\" is "+ abc.hashCode()); Data should be dispersed as randomly as possible across the hash table to minimise the chances of a collision. Ht.rehash(); CloseWords. Hashtable example in Java. Java - Differences between HashMap and Hashtable. Hashtable (Java 2 Platform SE v1.4.2)