Answers for "list vs map"

5

difference between list vs set vs map in java

Set is unordered
List is ordered collection, 
List allow duplicate elements
Set does not allow duplicates.
List can have multiple null elements
Set will allow only one null element.
The List can contain duplicate elements
Set includes unique items.
Posted by: Guest on December-05-2020
0

list vs map

List is collection of elements whereas map is collection of key-value pairs.
Posted by: Guest on December-05-2020
0

list vs map

LIST: Can store duplicate values,
      Keeps the insertion order. 
      It allows multiple null values, 
      Also we can read a certain value by index.
- ArrayList not syncronized, array based class 
- LinkedList not synchronized, doubly linked
- Vector is synchronized, thread safe
 
 MAP : is a (key-value format) 
      and keys are always unique, 
      and value can be duplicated. 
- HashTable don't have null key, sychronized(thread-safe)
- LinkedHashMap can have null key, keeps order
- HasHMap can have null key, order is not guaranteed
- TreeMap doesn't have null key and keys are sorted
Posted by: Guest on January-06-2021

Browse Popular Code Answers by Language