我的想法:如果…就返回,否则再判断是否合规!!
有错,应该先判断外层,筛选合规数据,再返回,不要太捉急写返回了。
我的代码
if (ed.contains(nowStr)){
return l;
}
if (dic.contains(nowStr)){
next.add(nowStr);
}
下面这串代码的想法:在dic里面找一个字符串,diic中存在,就去ed中找,如果ed中存在该字符串则返回结果,否则吧字符串给存储入next集合
优质代码:
if (dic.contains(nowStr)) {
if (ed.contains(nowStr)) {
return l;
} else {
//存储下一层的全部字符串。
next.add(nowStr);
}
}