I want some clarification about the differences between hashtable and hashmap in Java 8.
HashTable to my knowledge functions similarly to a HashMap but is threadsafe, and doesn't allow null keys or values. I am aware that Java 8 updates the HashMap class so that when there's a collision, rather than create a linked list of items with the same hash code in the bucket, it creates a tree.
Is this also the case with hashtable? And is the tree the default storage method even before a collision? (As in, when the first item to fit into a bucket is placed there, it's just a tree root with no branches.)
Also, how does java ensure that a hashtable is threadsafe? Does it create a que when two threads try to concurrently access a piece of data?