(Node<K, V> x)
| 1788 | |
| 1789 | |
| 1790 | private void leftRotate(Node<K, V> x) { |
| 1791 | Node<K, V> y = x.right; |
| 1792 | x.right = y.left; |
| 1793 | if (y.left != null) { |
| 1794 | y.left.parent = x; |
| 1795 | } |
| 1796 | y.parent = x.parent; |
| 1797 | if (x.parent == null) { |
| 1798 | root = y; |
| 1799 | } else { |
| 1800 | if (x == x.parent.left) { |
| 1801 | x.parent.left = y; |
| 1802 | } else { |
| 1803 | x.parent.right = y; |
| 1804 | } |
| 1805 | } |
| 1806 | y.left = x; |
| 1807 | x.parent = y; |
| 1808 | } |
| 1809 | |
| 1810 | |
| 1811 | /** |