Question: Ask a probing question. Share an insight from having read your colleagues posting. Offer and support an opinion. Validate an idea with your own experience.
Ask a probing question. Share an insight from having read your colleagues posting. Offer and support an opinion. Validate an idea with your own experience. Make a suggestion. Expand on your colleagues posting. note to expert .PICK ONE or two
As we learned previously, arrays can be useful tools for sorting information. ArrayLists, however, can be used as tools for sorting information just as well. There is a useful infographic found on rapidprogramming.com that breaks down the differences between these two structures. One interesting thing to note is that while arrays have a fixed size, ArrayLists do not. Another interesting point is that ArrayLists can only store objects, whereas arrays can store any type of data so long as each element of the array contains the same data type. Above, Taisa mentioned that the Contacts app on phone is a good example of these structures. I'd like to prpose that instead of using just one of these structures, the app would use both. Each field of the contacts (name, number, email, etc.) would be placed in a separate arrays of fixed size, say 500 elements. Then, the list of all contacts would be an ArrayList. For example, assume there are three arrays for name, number and email called "nam," "pho," and "em" respectively and an ArrayList called "cont" to hold the complete contact information. The first contant in the list would be cont[0] and would hold nam[0], pho[0], and em[0].
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
