774 |
|
} |
775 |
|
|
776 |
|
/** |
777 |
– |
* Finds or adds a node. A front-end for recursive version |
778 |
– |
* @return null if added |
779 |
– |
*/ |
780 |
– |
final TreeNode<V> putTreeNode(int h, Object k, V v) { |
781 |
– |
return putTreeNode(h, k, v, comparableClassFor(k)); |
782 |
– |
} |
783 |
– |
|
784 |
– |
/** |
777 |
|
* Returns the TreeNode (or null if not found) for the given key |
778 |
|
* starting at given root. |
779 |
|
*/ |
827 |
|
return r == null ? null : r.val; |
828 |
|
} |
829 |
|
|
838 |
– |
|
830 |
|
/** |
831 |
< |
* recursive add. |
831 |
> |
* Finds or adds a node. |
832 |
|
* @return null if added |
833 |
|
*/ |
834 |
|
@SuppressWarnings("unchecked") final TreeNode<V> putTreeNode |
835 |
< |
(int h, Object k, V v, Class<?> cc) { |
835 |
> |
(int h, Object k, V v) { |
836 |
> |
Class<?> cc = comparableClassFor(k); |
837 |
|
TreeNode<V> pp = root, p = null; |
838 |
|
int dir = 0; |
839 |
|
while (pp != null) { // find existing node or leaf to insert at |