Author: techfox9

Notes on Java Collections..

Monday, March 23rd, 2009 @ 11:32 pm

Collections characteristics:

  • synchronized (hashtable-yes, hashmap-no, vector-yes, arraylist-no)
  • directionality (iterators)
  • allow null values (hashtable-no, hashmap-yes)
  • preserve insert order
  • duplicates (set-no, list-yes)


  • Collections interfaces: Collection, Set, List and Map.
  • To synchronize HashMap:

    Map m = Collections.synchronizeMap(hashMap);

  • Some implementations: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.
  • An ArrayList is resizable, where as, an array is not.
  • Hashmap overrides?

    The methods to override are equals() and hashCode().

  • Difference between Enumeration and Iterator?

    Enumeration is read-only. Iterator provides remove and add methods
    and it is fail-fast in multi-threaded configurations.

Java, JavaUsage, Uncategorized


Comments are closed.