Is there any real use case for parallel arrays in Java? It seems too cumbersome to maintain N arrays which are interrelated.
Example:
int ages[] = {0, 17, 2, 52, 25};
String names[] = {"None", "Mike", "Billy", "Tom", "Stan"};
int parent[] = {0, 3, 1, 0, 3};
I can just create a class Person and store objects in one single array. Will be little more expensive, but much easy to use right?
Parallel arrays are a holdover from languages like Basic (the original one) that had no data structures other than arrays. You should define objects as you suggest, instead.