Compare every item to every other item in ArrayList

后端 未结 5 945
孤街浪徒
孤街浪徒 2021-02-05 08:07

I\'m having trouble with what I thought should be a pretty simple problem.

I need to compare every item in an arrayList with every other item in the the list without com

5条回答
  •  旧时难觅i
    2021-02-05 08:32

    for (int i = 0; i < list.size(); i++) {
      for (int j = i+1; j < list.size(); j++) {
        // compare list.get(i) and list.get(j)
      }
    }
    

提交回复
热议问题