还在用双层for循环吗?太慢了 - 女友在高考 - 博客园 (cnblogs.com)
private static void test3(List<Person> list1, List<Person> list2) { for (int i=0;i<list1.size();i++){ int jj = 0; for (int j = i; j < list2.size(); j++) { if (jj == list2.size()) { break; } if(list1.get(i).getPersonId().equals(list2.get(j).getPersonId())){ // 编写具体的逻辑 break; } if (j == list2.size() - 1) j = -1; jj += 1; } } }
标签:test3,双层,cnblogs,List,循环,优化 From: https://www.cnblogs.com/Insist-Y/p/16856580.html