We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
if (userFind != null) { jedisClient.zadd("Toptest", (double) user.getScore(), userFind); System.out.println("修改原有的!!!"); return; } //如果没有就加进去嘛,根据排行榜来区分 if (userList.size() >= 20) { if (user.getScore() + scoreCount > userList.get(19).getScore()) { System.out.println("大于排名20名中的最后一名就丢进缓存 :"); System.out.println("userList :" + userList.toString()); } } else { System.out.println("排行榜小于20人就直接丢进缓存 :"); if (userFind != null) { jedisClient.zadd("Toptest", (double) user.getScore(), user); } System.out.println("user " + userFind); }
这里两个userFind != null,但是前面已经return了,所以后面永远不会被执行吧? 还有userList.size() >= 20里边说明也没干?
userFind != null
userList.size() >= 20
The text was updated successfully, but these errors were encountered:
注释有把逻辑写清楚呀,一个是如果原来有就修改原来的;if (userList.size() >= 20) {后就是如果原来没有,就添加
Sorry, something went wrong.
我的意思是说,当userFind != null 的时候, 两个if (userFind != null) ,在第一个里边return了,所以第二个if (userFind != null) 就永远不会执行,这个代码就没有意义了。 就是System.out.println("排行榜小于20人就直接丢进缓存 :");下面那句if不会执行
if (userFind != null)
System.out.println("排行榜小于20人就直接丢进缓存 :");
if
呃,抱歉,我的错。第二个的if (userFind != null)是没有意义的,马上修正。感谢提醒。
No branches or pull requests
这里两个
userFind != null
,但是前面已经return了,所以后面永远不会被执行吧?还有
userList.size() >= 20
里边说明也没干?The text was updated successfully, but these errors were encountered: