Month: December 2011

Collection classes in Java

Collections are very important on SCJP exam. It’s useful to remember the following…



  • ordered (index)
  • duplicates allowed


  • fast iteration
  • fast random access; as of Java 1.4 implements RandomAccess interface
  • slower instertion and deletion


  • the same as ArrayList but its metods are synchronized (therefore slower)


  • elements are doubly linked to one another; linkage adds methods that allow

Assertions in Java

assert Expression1 : Expression2;
  • Expression1 is asserted to be true; otherwise AssertionError (that shouldn’t be handled) is thrown
  • Expression2 allows to produce some additional information
  • Expression2 MUST result in a value – it generates a String message
  • allow testing during the development and debugging
  • are disabled at runtime by default
  • can be enabled using -ea or -enableassertions flags and selectively