Compare every item to every other item in ArrayList

后端 未结 5 947
孤街浪徒
孤街浪徒 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条回答
  •  半阙折子戏
    2021-02-05 08:28

    What's the problem with using for loop inside, just like outside?

    for (int j = i + 1; j < list.size(); ++j) {
        ...
    }
    

    In general, since Java 5, I used iterators only once or twice.

提交回复
热议问题