im making a java mobile app to display quotes by people. It would have over 18000 quotes, categorized by person and number of quotes. Users of my app would enter the person number and quote number for that person. (two separate numbers). Should i use a nested switch case or an if else statement? or is there another way for doing this? maybe instead of making strings of each quote, make text files with the quotes(1 text file per person) n use a single switch case to get person n goto line no. of the text file for that person? which method would be faster n easier for the mobile it is being run on? Thanks in advance! 🙂
Share
You could load quote files on-demand and cache their quotes for use in the same session, e.g.:
You’ll likely need the text file approach anyway, unless you’re keen on writing or generating code for a class containing all the quote data – e.g. a
String[][], with person and quote number as indices and another String[] containing people’s names – which is another option if you have enough memory available. Getting a particular quote from such a structure would just be a case using the given numbers asarray indices (performing range chaching as you go).