Hello Markus, Thank you for your response! Regarding Arrays.asList(T[]).contains(T), you are right that it works well for Object arrays. However, 
my main driver for this proposal is primitive arrays (like char[], int[], etc.). Currently to check a primitive array, you have to either: 1. 
Write a manual for loop. 2. Use a Stream, which has object overhead. 3. Or box the primitives into a Collection, which is very memory intensive. 
I believe Arrays.contains(char[], char) provides a high performance, readable alternative that feels "missing" from the current utility 
suite. This alternative also offers much ease to new Java learners who have come from other languages like Python where something like this is 
already included. Thank you for the link to the OCA. I am located in the USA and I have my parents ready to help me with the legal signature once 
we have a "go signal" on the technical direction! Regards, Arnav On Apr 5, 2026, at 5:06 PM, Markus KARG <[email protected]> 
wrote: Hello Arnav, thank you for sharing your proposal. It looks rather straightforward and indeed filling a "simply missing" gap! I 
wonder what would be the actual benefit (other than just being shorter) over using Arrays.asList(T[]).contains(T) simply? Is there a specific 
need to go with raw arrays instead? Applications typically do not use arrays but instead go with the Collections Framework, so I wonder what you 
driver is. What help can I give with the OCA process other than pointing you to https://oca.opensource.oracle.com/ and kindly noting that in some 
countries it might need your parent's agreement to sign legal documents? Regards -Markus Am 05.04.2026 um 16:58 schrieb Arnav Somaghatta: Hello, 
My name is Arnav, and I am a 14-year-old developer who is interested in contributing to the OpenJDK. I would like to propose adding a set of 
"contains" methods to the java.util.Arrays class. Currently, to check if a primitive array (like char or int) contains a specific value 
needs a large manual for loop, converting to a List, or using a very complicated Stream pipeline. My idea proposes adding a series of static 
"contains" methods for all 8 primitive types to java.util.Arrays public static boolean contains(char[] a, char key) public static 
boolean contains(int[] a, int key) public static boolean contains(byte[] a, byte key) public static boolean contains(short[] a, short key) public 
static boolean contains(long[] a, long key) public static boolean contains(float[] a, float key) public static boolean contains(double[] a, 
double key) public static boolean contains(boolean[] a, boolean key) Why should you consider this proposal? Arrays.contains(myChars, 'a') is much 
more readable than workarounds like a for loop. For newer Java learners, not having a "contains" method on arrays is very confusing 
when you compare it to other languages like Python. If this proposal is viewed favorably, I am willing to make all of the 8 primitive overloads 
and any of the corresponding unit tests. I am also looking for a sponsor to help me navigate the OCA process for minors and guide me through the 
technical process of pushing these changes. I look forward to your feedback on whether this is a direction the Core Libs group would support. 
Thank you so much for considering my idea and reading through this email, your support means a lot to me! Thank you, Arnav

Reply via email to