I don't even know how to ask for help with this i must just be missing something obvious

???

without the rest of the code its difficult to say where the error is occurring however index out of bounds means you’re trying to access an index that doesnt exists. So I’m guessing there might be an issue when you add data to camData.

the actual error i’m getting makes sense, i expected that error to happen when camData.get(0) was “*”, that’s why i made the if else gate, to make sure it didn’t try to do that part of the code in that case. my question is why is the code even going to the else here. why is it returning false.

is it possible that it’s evaluating strings as unique objects?? so that’s why “asterisk” != “asterisk” because really it’s like are these two separate string objects, both of the value “*”, the same object?

again its not return false, its return indexOutOfBounds, the value you are passing through get exceeds the size of your array.

Also the error is not suggesting any problem with the string conversion so thats not the issue. The issue is your array is of size one, meaning it contains only one object and you are trying to access object number 2 at index 1 and the compiler cannot find that index in the array.

i understand why the error is happening, my question is why is the code even executing that line. the if statement should return true in that case, because camData.get(0) is “*”

solved! i was right it was treating camData.get(0) like an instance of a string object, not comparing the values. i just had to do .equals() instead of ==

3 Likes

Yeah, a similar issue happened to me. From what I understand, strings have a “start” and “end” value. They are treated as characters by the computer, but not displayed. So when you are comparing two strings, it doesn’t match.

String a = "abc", b="abc";
print( a==b ); //output -> TRUE

String c = "hi this is it!", d = "this";
String e[] = split(c," "); //splits into {"hi","this","is","it!"};
print(c[1] == d); //output -> FALSE