Hashtables (usually) perform search operations (search), limited in complexity O(n)<=T(n)<=O(1) , with an average case complexity of O(1 + n/k) ; however, binary search trees (BST) perform search (search) operations limited in complexity O(n)<=T(n)<=O(log_2(n)) , with an average case complexity of O(log_2(n)) . The implementation for each (and each) data structure must be known (by you) in order to understand the advantages, disadvantages, complexity of the operation time, and code complexity.
For example, the number of entries in a hash table often has some fixed number of entries (some of which may not be populated at all) with collision lists. On the other hand, trees usually have two pointers (links) to a node, but it can be more if the implementation allows more than two child nodes on a node, and this allows the tree to grow as nodes are added, but may not allow duplicates. (By default, the Java TreeMap implementation does not allow duplicates)
There are also special cases, for example, what if the number of elements in a particular data structure increases unlimitedly or approaches the limit of the basic part of the data structure? What about amortized operations that perform some rebalancing or cleaning operation?
For example, in a hash table, when the number of elements in the table becomes large enough and an arbitrary number of collisions can occur. Trees, on the other hand, usually require a rebalancing procedure after insertion (or removal).
So, if you have something like a cache (for example, the number of restricted elements or the size is known), then a hash table is probably best; however, if you have something more like a dictionary (for example, once and many times searched many times), I would use a tree.
This is only in the general case, however (no information was given). You need to understand the process that happens the way they make the right choice when choosing a data structure.
When I need a multi-map (range search) or sorted anti-aliasing of a collection, then it cannot be a hash table.