Yahoo India Web Search

Search results

  1. HashTable and HashMap are member of the Java Collections Framework (since Java 2 platform v1.2, HashTable was retrofitted to implement the Map interface). HashTable is considered legacy code, the documentation advise to use ConcurrentHashMap in place of Hashtable if a thread-safe highly-concurrent implementation is desired.

  2. Sep 26, 2008 · A hashtable, on the other hand, has an associated function that takes an entry, and reduces it to a number, a hash-key. This number is then used as an index into the array, and this is where you store the entry. A hashtable revolves around an array, which initially starts out empty. Empty does not mean zero length, the array starts out with a ...

  3. Dec 2, 2010 · Hashtable is a legacy collection which was replaced by Java 1.2 collections in 1998. I suggest you avoid it, along with Vector and Enumeration. Instead of Hashtable use HashMap where possible. You can add synchronization using Collections.synchronizedMap(map) if you need it. Instead of Vector, use ArrayList where possible.

  4. Mar 8, 2012 · 18. In C# you can initialize Hashtables (and many other types of objects) using code like this -. Hashtable table = new Hashtable {{1, 1}, {2, 2}}; Is there anything like this in Java or do you have to just declare the Hashtable first and then manually put items in it one by one? java.

  5. Just to throw this out, there is a (much maligned) class named java.util.Properties that is an extension of Hashtable. It expects only String keys and values and lets you load and store the data using files or streams.

  6. Mar 24, 2015 · Besides: why are you using a Hashtable when you use it with an numeric index - why not using an ArrayList<String> instead. – GhostCat Commented Mar 24, 2015 at 15:50

  7. Sep 13, 2010 · As @Giuseppe mentioned, you can define it like this: Hashtable<Integer, ArrayList<Byte>> table = new Hashtable<Integer, ArrayList<Byte>>(); and then put primitive int 's in it as keys: table.put(4, ...); because since Java 1.5, autoboxing will automatically change the primitive int into an Integer (a wrapper) behind the scenes. If you need more ...

  8. Nov 22, 2011 · A better replacement for Hashtable is HashMap. As for being obsolete, I have no reference to it, but the Javadoc states: As of the Java 2 platform v1.2, this class was retrofitted to implement the Map interface, making it a member of the Java Collections Framework. Hashtable is synchronized unlike HashMap. edited Nov 22, 2011 at 7:08.

  9. Mar 19, 2012 · As of the Java 2 platform v1.2, this class was retrofitted to implement the Map interface, making it a member of the Java Collections Framework. Unlike the new collection implementations, Hashtable is synchronized. If a thread-safe implementation is not needed, it is recommended to use HashMap in place of Hashtable.

  10. Nov 21, 2013 · System.out.println("Please enter your choice to use the HashTable: (999: End of program) "); System.out.println("Read the files, store data in an array, and display. the content: 1 "); System.out.println("Read the files and store the data in the HashTable, and. dislay the content of the hashtable: 2"); choice = keyboard.nextInt();

  1. People also search for