@Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }

        @SuppressWarnings("unchecked")
        BinaryTree<T> bt = (BinaryTree<T>) o;
        if (data != null ? !data.equals(bt.data) : bt.data != null) {
            return false;
        }

        if (left != null ? !left.equals(bt.left) : bt.left != null) {
            return false;
        }

        if (right != null ? !right.equals(bt.right) : bt.right != null) {
            return false;
        }
        return true;
    }