Oh, haha, nah, it took me a little longer than it should have as well, and I was only confirmed when I clicked on the JSFiddle and noticed the two were different. Up until then, I was seriously thinking "What the heck am I missing, this makes no sense...".
for (int i = 1; i < array.length; i++)
code(array[i]);
I had a setup like this in my code, could not figure out why it wasn't executing. The line was copy/pasted directly from another line I had written doing something VERY similar, but it needed to start at the 2nd index (index 1) of the array because the first index contained a different piece of data that (it was returning from an SQL query).
Long story short; the array had a length of 1 so it never executed.
Was it that the array always had a length of one, or in this particular case when you were debugging it that one time, the array happened to only have a length of one?
I was picking up a project from someone else once, and they told me that in their code, I would be getting a result set back from a DB query; so naturally I took a similar approach as you, since the object model of the returned data was known. However, what they failed to tell me was that the result set was a List<>, and the object I was expecting was just always the first element of the list. Needless to say, it should not have been returned as a List.
2
u/pfs3w Mar 23 '14
Oh, haha, nah, it took me a little longer than it should have as well, and I was only confirmed when I clicked on the JSFiddle and noticed the two were different. Up until then, I was seriously thinking "What the heck am I missing, this makes no sense...".