Should i store one arrayList per file or should i store all my arrayList in the same file? [closed]

人盡茶涼 提交于 2020-01-06 06:34:08

问题


I'm doing my first Mobile App and i have been studying java for about 2 weeks now so i'm pretty new. The app that i'm trying to make is a grocery list app.

Basically, I want to sort my grocery list by department wise. For example:
Fruit items will go in a fruitArray
the meat items will go in meatArray
etc.

Should I create a single file for each department (Fruit, meat, bakery) or can i store all my array in the same file and access them separately?

I did some search but i cannot find a topic that answers my question.

I would like to know what would be the best way to do it and if it's to put the arrays in the same file, how can i do that ?

Thanks☺


回答1:


When you're doing or learning something new, do whatever works for you. Consider trying to do both, as it's experience you'll gain for future.

Some general things to take note of though :

  1. Storing all items in one file could potentially create one massive file (regardless of the project you're working on, im generalizing now)
  2. Storing items in different files increases the overhead of having to handle and manage different files.

These are things you will have to consider and things you'll learn from experience, based on the project and various different aspects.

For the sake of this question, I think storing different items in different files would potentially be a better, simpler solution for now, but it really depends on the entire project and how you plan to implement it. Hope this at least somewhat answers your question. Happy coding and happy learning



来源:https://stackoverflow.com/questions/57098645/should-i-store-one-arraylist-per-file-or-should-i-store-all-my-arraylist-in-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!