java - Arraylist search for 2 elements in a specified order -


i make code, can search 2 elements in arraylist. order of elements important. searched elements: adjlists.get(l).get(h), adjlists.get(l).get(h+1)

list list=new arraylist(); list.add(adjlists.get(l).get(h)); list.add(adjlists.get(l).get(h+1));  for(list<integer> arraylist:adjlists) {    while (arraylist.containsall(list)) {     arraylist.set(arraylist.indexof(adjlists.get(l).get(h + 1) + 1), 1);    } } 

you can use collections.indexofsublist

    int = collections.indexofsublist(list, arrays.aslist(o1, o2)); 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -