Deque and Queue are derived from:
Anonymous Quiz
6%
AbstractList
45%
Collection
26%
AbstractCollection
23%
List
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
class Employee{
String name;
public Employee(){}
public Employee(String name){
this.name=name;
}
public String toString(){
return "name"+name;
}
static class comparatorName implements Comparator<Employee>{
public int compare(Employee obj1,Employee obj2){
return obj1.name.compareTo(obj2.name);
}
}
}
public class Program
{
public static void main(String[] args) {
Employee e1=new Employee("ankit");
Employee e2=new Employee("brad");
ArrayList<Employee> list=new ArrayList<Employee>();
list.add(e1);
list.add(e2);
Collections.sort(list,new Employee.comparatorName());
System.out.println(list);
}
}
import java.util.Collections;
import java.util.Comparator;
class Employee{
String name;
public Employee(){}
public Employee(String name){
this.name=name;
}
public String toString(){
return "name"+name;
}
static class comparatorName implements Comparator<Employee>{
public int compare(Employee obj1,Employee obj2){
return obj1.name.compareTo(obj2.name);
}
}
}
public class Program
{
public static void main(String[] args) {
Employee e1=new Employee("ankit");
Employee e2=new Employee("brad");
ArrayList<Employee> list=new ArrayList<Employee>();
list.add(e1);
list.add(e2);
Collections.sort(list,new Employee.comparatorName());
System.out.println(list);
}
}
What guarantees type-safety in a collection?
Anonymous Quiz
42%
Generics
26%
Abstract classes
29%
Interface
3%
Collection
The most used interfaces from the Collection framework are?
Anonymous Quiz
23%
List
15%
Map
5%
Set
56%
All of these
The root interface of Java Collection framework hierarchy is -
Anonymous Quiz
51%
Collection
5%
Root
35%
Collections
8%
List/Set
Which of these is synchronized?
Anonymous Quiz
13%
ArrayList
38%
LinkedList
33%
Vector
18%
None of these
ArrayList implements which of the following?
Anonymous Quiz
32%
List
18%
RandomAccess
13%
Cloneable
37%
All of these
Which of these allows the storage of many null values?
Anonymous Quiz
5%
Set
55%
List
21%
None of these
18%
All of these
nextIndex() and previousIndex() are methods of which interface?
Anonymous Quiz
13%
IndexIterator
23%
Iterator
48%
ListIterator
16%
NextPreviousIterator
Vector extends which of these?
Anonymous Quiz
19%
ArrayList
25%
LinkedList
42%
AbstractList
14%
None
In Iterator, nextElement() method of Enumeration has been changed to:
Anonymous Quiz
42%
next()
35%
getNext()
19%
returnNext()
3%
name remains same
From Java 5 onwards, which one of these is recommended to replace Hashtable?
Anonymous Quiz
28%
ConcurrentHashMap
38%
HashMap
34%
ConcurrentHashtable
0%
None
Which does not allow to store a null value?
Anonymous Quiz
44%
TreeSet
15%
LinkedHashSet
32%
HashSet
9%
None
What describes how well an algorithm performs in best, average or worse case scenarios?
Anonymous Quiz
8%
Big-B
62%
Big-O
31%
Big-Data
0%
Big-N