Skip to content

Commit 973965d

Browse files
authored
Update README.md
1 parent 235d73d commit 973965d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ Lists implement the ```List``` interface:
1717
Basic rules of thumb for ```ArrayList``` and ```LinkedList```:
1818
* ```ArrayList``` is like an array. Meaning that removing entries from the end is fast - internally only the length of the array is shortened. But adding or removing entries from the beginning is slow - internally this means copying all the remaining entries to a new array. If you only want to add or remove items in the end of your list, use ```ArrayList```. ```ArrayList``` manages array internally. Accessing elements by index is very fast. Adding item at the beginning takes long time because the items need to be shifted. Near to the end it is faster, because less elements need to be shifted.
1919
* ```LinkedList```: this is based on doubly linked list data structure. If you want to add or remove items anywhere in the list, also in the middle, use ```LinkedList```. If you add items near the end of the list, ```ArrayList``` can be more efficient than ```LinkedList```. In ```LinkedList```, each element stores a reference to the previous and to the next element. To get an item at a particular index can be slower, because the list needs to iterate until that item. But adding an item anywhere is fast, because the links need to be changed, but shifting is not needed.
20+
21+
## ```HashMap```
22+
Can store key-value pairs. Implements the ```Map``` interface. Creates a lookup table where values can be looked up based on keys. Does not maintain order!
23+
24+
## Sorted maps: ```LinkedMap``` and ```TreeHashMap```

0 commit comments

Comments
 (0)