我应该为每个文件存储一个arrayList还是应该将所有arrayList存储在同一文件中? [英] Should i store one arrayList per file or should i store all my arrayList in the same file?

查看:47
本文介绍了我应该为每个文件存储一个arrayList还是应该将所有arrayList存储在同一文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做我的第一个移动应用程序,并且我已经学习Java大约2周了,所以我很新.我要制作的应用是购物清单应用.

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.

基本上,我想按部门明智地排序我的购物清单.例如:
水果项目将放入fruitArray
肉类项目将放入meatArray

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 ?

谢谢☺

推荐答案

当您在做或学习新东西时,请为您做任何可行的事情.考虑尝试两者都做,因为它将为您带来未来的经验.

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. 将所有项目存储在一个文件中可能会创建一个大文件(无论您正在处理的项目是什么,现在概括一下)
  2. 将项目存储在不同的文件中会增加必须处理和管理不同文件的开销.

根据项目和各个不同方面,这些都是您必须考虑的事情,以及将从经验中学到的东西.

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

这篇关于我应该为每个文件存储一个arrayList还是应该将所有arrayList存储在同一文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆