Collections Java Interview Questions – Set 05

What is an Iterator Some of the collection classes provide traversal of their contents via a java.util.Iterator interface. This interface allows you to walk through a collection of objects, operating on each object in turn. Remember when using Iterators that they contain a snapshot of the collection at the time the Iterator was obtained; generally … Read more

Collections Java Interview Questions – Set 04

What do you know about the big-O notation and can you give some examples with respect to different data structures The Big-O notation simply describes how well an algorithm scales or performs in the worst case scenario as the number of elements in a data structure increases.  The Big-O notation can also be used to … Read more

Collections Java Interview Questions – Set 03

What is the importance of hashCode() and equals() methods? How they are used in Java The java.lang.Object has two methods defined in it. They are – public boolean equals(Object obj) public int hashCode(). These two methods are used heavily when objects are stored in collections. There is a contract between these two methods which should … Read more

Collections Java Interview Questions – Set 02

What is the Collections API? The Collections API is a set of classes and interfaces that support operations on collections of objects. What is an Iterator interface? The Iterator interface is used to step through the elements of a Collection. The Iterator is an interface, used to traverse through the elements of a Collection. It is not … Read more

Collections Java Interview Questions – Set 01

Can you write code to sort the following string values naturally (i.e. in alphabetical order)? (JEE, Java, Servlets, JMS, JNDI, JDBC, JSP, and EJB) Here is the sample code that makes use of the default compareTo( ) provided in the String class as it implements the Comparable interface and the Collections utility class that provides … Read more

Collections Java Interview Questions

Collections Java Interview Questions – Set 05 Collections Java Interview Questions – Set 04 Collections Java Interview Questions – Set 03 Collections Java Interview Questions – Set 02 Collections Java Interview Questions – Set 01