Sorting Arrays
COMP 1010 Home > Parallel Arrays
IntroductionParallel arrays are a predecesor of object arrays, which you will not be learning.(Placeholder)
|
---|
{{{Body}}}
Parallel arrays are an advanced use of arrays. Creation and use is fairly simple, and a natural step from creating and using simple arrays.
Parallel arrays should be used wherever you want to make a complex structure of similar or related data, but do not have the means.
Parallel Array Use
Parallel arrays should be used whenever you need to create a list of items, but all the information you need to store will not fit into a single Primitive Data Type. For example, you need to to keep a list of people's names and addresses. A single array of Strings seperating the addresses from names with a comma might not practical, and difficult to implement. Using one array for names, and another array of equal size for addresses would be easier and more practical.
String []names = new String[numberOfPeople]; String []addresses = new String[numberOfPeople];