The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

I have also tried declaring a string variable to compare the itr.toString() and itr.next().toString() but after further testing, different line numbers result in the same string, this made no sense to me. I just added a .toString() method at the end of my line number printer.
I tried making an integer variable to store the previous value but had a type mismatch error converting from object to int. this part confused me the most as I know I am pulling a value from inside an object.

But to answer your question, they are next to each other in the list. I don't know EXACTLY what separates them but when I print out the map entries or the entry values they are both listed in the format "[#,#]"

Re: Presumably simple fix sets/maps

There is currently no point in my code that saves an item for checking. How would I save the value itr.next() prints? I cannot make some integer variable and just assign it to equal itr.next() as my IDE gives me a cannot convert from object to int error.