fix: Use .equals() to compare two strings in Java (#961)

This commit is contained in:
selear 2023-11-21 21:20:04 +08:00 committed by GitHub
parent 9b35f75505
commit 5b6fb34a82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,15 +63,15 @@ class ArrayBinaryTree {
if (val(i) == null) if (val(i) == null)
return; return;
// 前序遍历 // 前序遍历
if (order == "pre") if ("pre".equals(order))
res.add(val(i)); res.add(val(i));
dfs(left(i), order, res); dfs(left(i), order, res);
// 中序遍历 // 中序遍历
if (order == "in") if ("in".equals(order))
res.add(val(i)); res.add(val(i));
dfs(right(i), order, res); dfs(right(i), order, res);
// 后序遍历 // 后序遍历
if (order == "post") if ("post".equals(order))
res.add(val(i)); res.add(val(i));
} }