Getting an item from an array
Hi, I'm having a small problem with an array list: I am trying to find the best way to see if it is in order without sorting it, so I'm trying to iterate through each item and check that it is < the next item.
I have tried to use an iterator:
but it cannot find method next(). I don't know what I need to do to correct it, I know that a primitive array you can get the nth item by using array[n] and so maybe could have a counter and compare each item that way, but I don't know how to do it using ArrayList.
for (Integer node : nodes)
Iterator it = nodes.iterator();
if (node < node.next())