List.contains方法

if (null != this.engagedNodeIDs && this.engagedNodeIDs.size() > 0) {
for (i = 0; i < this.engagedNodeIDs.size(); i++) { if (this.engagedNodeIDs.get(i).equals(node.getUNID())) { nodeState = "0"; } } } -------------------------------------------------------------------------------- //上面7行等价于以下注释的三行 if(null!=engagedNodeIDs&&engagedNodeIDs.contains(node.getUNID())){ nodeState = "0"; }

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.