Does Java have a built-function to allow me to linearly search for an element in an array or do I have to just use a for loop?
There is a contains method for lists, so you should be able to do:
contains
Arrays.asList(yourArray).contains(yourObject);
Warning: this might not do what you (or I) expect, see Tom's comment below.
2.1m questions
2.1m answers
60 comments
57.0k users