English 中文(简体)
单一或多重名单
原标题:Single or Multiple Lists

Is it better to have multiple lists or a single list? Currently I am using three lists to better organize a class I have for a project I am helping with. These three lists all hold the same class type but have different purposes and to be used at different times in the program. I originally split it up so I can easily distinguish between the classes in a JAXB xml generated file and to help with a module i created in netbeans, however I realized it could possibly be less taxing if i simply subclass say ArrayList (or if i put them in the correct order they will be used I could use LinkedList) and put all of the objects from the other three lists in it and simply add a method in the class going into the Array to help specify what type of class it is ie Passive Active Contact, I could also add three methods that would create smaller lists holding only the objects of one of the three types mentioned above. Right now the average size for all three lists together is about 6 to 10 What would be the best way to handle this should I leave it as is or create a large list of classes?

问题回答

由于内容不多,我将不注重效率,而是注重你的法典的可读性,以避免ug,并方便今后进行变革。 我认为,在这种情况下,你描述的可读性的最佳办法是有不同的清单,但你能够更好地确定这一点。

我现在就离开了。 页: 1 这三个目标不同,在节目的不同时间使用,因此,自然将这三个目标作为3个斜体,而不是1个。 你们不能混淆对你们的物体(和班级)。 如果每个清单都适合不同情况,那么它们就应当单独列出,即使它们具有同样的价值。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签