How to compare arraylist value and array value in java -
int sizeoftheshortestlist = webresult.size(); (int i=0; i<sizeoftheshortestlist; i++) { if (webresult1.get(i).equals(dbresult[i]) ) { system.out.println("equals..: " + webresult1.get(i)); } }
from above code find errors please give solution compare arraylist values , array values
take arraylist 'al'. take array 'a'.
now u need compare 'al' , 'a'.
iterator = new iterator(al); int length = a.size(); int count=0; for(int i=0;i<length; i++) { if(it.next()==a[i]); { count++; } } if(count == length) { system.out.println("both equal"); } else { system.out.println("both not equal"); }
Comments
Post a Comment