Is an object contained in an array?

Most of the traditional ways to see if an object is contained in an array in Java require the use of sets and generics. However, generics were not included in Java until version 1.5, while the Java that runs on the BlackBerry OS is based off of J2ME, which is based off of version 1.4 of Java. As such a different approach needs to be used to determine if an object is in an array when coding for BlackBerry. While you could (of course) write your own method using a for loop, there is an easier way.

import net.rim.device.api.util.Arrays;

String[] nameArray = new String[]{"John","Paul","George","Ringo"};
String testValue = "Paul";


While this examples uses an array of strings, this approach will in fact work for any Object type.