Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

2009/08/14

HashTable vs. HashMap

Both provide key-value access to data. The Hashtable is one of the original collection classes in Java. HashMap is part of the new Collections Framework, added with Java 2, v1.2.

1. The key difference: Access to the Hashtable is synchronized on the table while access to the HashMap isn't. You can add it, but it isn't there by default.

2. Iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't. If you change the map while iterating, you'll know.

3. HashMap permits null values in it, while Hashtable doesn't.


2009/08/13

Java Beans

From Wikipedia,

JavaBeans
are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects. A JavaBean is a Java Object that is serializable, has a nullary constructor, and allows access to properties using getter and setter methods.
!

Google Analytics

Blog Archive

Followers