1 Star 0 Fork 462

誓言/bullshit-codes

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CheckExist.java 712 Bytes
一键复制 编辑 原始数据 按行查看 历史
/**
* 是否收藏(有没有感觉这段代码特别特别啰嗦,不够简洁)
* @param articleKey
* @param user
* @return
*/
public boolean isFavorite(String articleKey, User user) {
boolean isFavorite = false;
if (user == null) {
return false;
}
long userId = user.getId();
Article article = getByArticleKey(articleKey);
if (null == article) {
return false;
}
List<Long> list = listAttentionUsers(article);
if (list == null || list.size() <= 0) {
return false;
}
for (Long id : list) {
if (id == userId) {
isFavorite = true;
break;
}
}
return isFavorite;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/java521/bullshit-codes.git
git@gitee.com:java521/bullshit-codes.git
java521
bullshit-codes
bullshit-codes
master

搜索帮助