January 2014
Intermediate to advanced
736 pages
70h 43m
English
This app uses various data structures from the java.util package. The app dynamically loads the image file names for the enabled regions and stores them in an ArrayList<String>. We use Collections method shuffle to randomize the order of the image file names for each new game. We use a second ArrayList<String> to hold the image file names of the countries in the current quiz. We also use a Set<String> to store the world regions included in a quiz. We refer to the ArrayList<String> object with a variable of interface type List<String>—this is a good Java programming practice that enables you to change data structures easily without affecting the rest of your app’s code.
Read now
Unlock full access