Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Test.java and MathGame.java #2643

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xiezheng-XD
Copy link

对于/math-game/src/main/java/demo/MathGame.java,做了以下几处改动:
1.限制产生的随机最小值为2,防止后步比较时出现number<i的错误
2.将StringBuffer替换为StringBuilder以提高性能和线程安全性

对于/testcase/src/main/java/com/alibaba/arthas/Test.java,做了以下几点改动:
1.Map的初始化指定了具体的类型参数,减少类型转换时出错的可能性
2.将p初始化为非空的默认值,因其在System.out.println(p)时可能存在空指针异常的风险
3.修改随机数的产生逻辑,防止性能上的损耗
4.增加用户友好的异常退出机制

做了以下几点改动:
1.Map的初始化指定了具体的类型参数,减少类型转换时出错的可能性
2.将p初始化为非空的默认值,因其在System.out.println(p)时可能存在空指针异常的风险
3.修改随机数的产生逻辑,防止性能上的损耗
4.增加用户友好的退出机制
做了以下几处改动:
1.限制产生的随机最小值为2,防止后步比较时出现number<i的错误
2.将StringBuffer替换为StringBuilder以提高性能和线程安全性
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant