Just it doesn’t add duplicate values. Boolean add(E e) – Adds the specified element to this set if it is not already present (optional operation). As, add() method returns Boolean and on adding duplicates
Category: Java Collections Interview Questions
Java Collections interview questions and answers for freshers and experienced asked in technical interviews in IT companies for software job | Only Real
Answer: Time complexity for the methods offer & poll is O(log(n)) and for the peek() it is Constant time O(1) of java priority queue. SIDE
Answer: ADT (Abstract Data type) represents a set of particular behaviors. for example, LIST represents a sequence of values, a QUEUE represents a FIFO(First in
Both java queue add () and offer () methods are available in the Queue interface and are used to add elements to the queue. Preference
Difference between Arraylist and Vector in java in Java Collections. I’ll be listing 4 important differences between java arraylist and vector data structures. Java ArrayList
Answer: For sorting employees we need to use either Comparable or comparator interface. Since, as per question, the Employee class is not allowed to implement
Answer: Here is the differences and advantages of ListIterator over Iterator. 1-Iterator is available to all Collection classes whereas ListIterator is available to only List
Answer includes advantages of comparator over comparable interfaces in java and the differences between them. As a side note, what’re advantages of comparator over comparable, and when would
List of Java Collection short interview questions and answer asked in software job / technical interviews. This list is helpful for telephonic or face to
Answer: Vector & time complexity in Java: Vector is a dynamic array that grows or shrinks on run time to accommodate items during addition or