Question: I have N numbers in arraylist. To get the `indexOf`, arraylist will have to iterate maximum N times, so complexity is `O(N)`, is that correct?

Answer: 
Source [Java API](http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html)

Yes,Complexity is O(N).

The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking). The constant factor is low compared to that for the LinkedList implementation.
100%, it needs to iterate through the list to find the correct index.