1. Random Access Interface is implemented by Vector and ArrayList to ensure the speed of the retrieval of the elements.
2. ArrayList and Linked list has 1 null allowed and maintains insertion order of elements because they both implements List interface
3. HashTable and Vectors are synchronized so they are thread safe but bit slower than other ones
4. Entry is an interface in JAVA. In collection Entry is a group of key value pairs. Map is collection of entry objects.
5. None of the Maps in Java allows duplicate Keys but they allow duplicate Values.
6. ArrayList is faster for data fetching but slow for insertion of data at any index. Linked list is faster for insertion of data at any index
7. Null Key-value allowed or not and what order is maintained for each of them :
HashMap : Y - Y , No Order
HashTable: N - N , No Order
LinkedHashMap : Y - Y , Insertion Order
Treemap : N- Y , Sorted Order
8. Concurrent HashMap is thread safe in different way :
-> For Read Operation it doesn't locks the object
-> For write operation it locks the particular segment (Segment locking or bucket locking) in which updation is going on. By default there are 16 segments.
9. In TreeSet/Map only homogeneous objects are allowed otherwise it gives ClassCastException.
10. If modification is going on concurrently with other operation ConcurrentModificationException will hit.
11. If a null Key/Value is not allowed and we try to give null value it gives NullPointerException
12. Iterable -> Collection -> Set -> SortedSet -> NavigableSet -> TreeSet
Iterable -> Collection -> Set ->HashSet -> LinkedHashSet
13. In case of weak HashMap if Object doesn't has any reference , it became eligible for garbage collection
14. HashTable implements Map and extends Dictionary
15. If we compare Array with arrayList we will find that Array is faster because of its fixed size
16. Collection only holds non-primitives and Objects
17. Comparable and Comparator are 2 interfaces
18. Default Capacity of ArrayList is 10.
19. In HashMap JVM uses ".equals" method to find the duplicates while in Identity HashMap JVM used "==" to find duplicates
20. There are 3 types of cursors : Iterator , ListIterator and Enumerator
21. To synchronize a Collection we use synchronizedCollection method of Collections class. This will return a symchronized collection.
2. ArrayList and Linked list has 1 null allowed and maintains insertion order of elements because they both implements List interface
3. HashTable and Vectors are synchronized so they are thread safe but bit slower than other ones
4. Entry is an interface in JAVA. In collection Entry is a group of key value pairs. Map is collection of entry objects.
5. None of the Maps in Java allows duplicate Keys but they allow duplicate Values.
6. ArrayList is faster for data fetching but slow for insertion of data at any index. Linked list is faster for insertion of data at any index
7. Null Key-value allowed or not and what order is maintained for each of them :
HashMap : Y - Y , No Order
HashTable: N - N , No Order
LinkedHashMap : Y - Y , Insertion Order
Treemap : N- Y , Sorted Order
8. Concurrent HashMap is thread safe in different way :
-> For Read Operation it doesn't locks the object
-> For write operation it locks the particular segment (Segment locking or bucket locking) in which updation is going on. By default there are 16 segments.
9. In TreeSet/Map only homogeneous objects are allowed otherwise it gives ClassCastException.
10. If modification is going on concurrently with other operation ConcurrentModificationException will hit.
11. If a null Key/Value is not allowed and we try to give null value it gives NullPointerException
12. Iterable -> Collection -> Set -> SortedSet -> NavigableSet -> TreeSet
Iterable -> Collection -> Set ->HashSet -> LinkedHashSet
13. In case of weak HashMap if Object doesn't has any reference , it became eligible for garbage collection
14. HashTable implements Map and extends Dictionary
15. If we compare Array with arrayList we will find that Array is faster because of its fixed size
16. Collection only holds non-primitives and Objects
17. Comparable and Comparator are 2 interfaces
18. Default Capacity of ArrayList is 10.
19. In HashMap JVM uses ".equals" method to find the duplicates while in Identity HashMap JVM used "==" to find duplicates
20. There are 3 types of cursors : Iterator , ListIterator and Enumerator
21. To synchronize a Collection we use synchronizedCollection method of Collections class. This will return a symchronized collection.
No comments:
Post a Comment