First of all, the code you posted is not complete. What class and method is this code in? When I asked for code, I was more interested in class structure (field and methods) rather than the details of the method implementations. Also, it will help if you show what you have in the "other file". In particular, what is the class name? What methods and fields does it have?
The idea here is that you are looking at design issues. When we talk about design, we typically ignore the details inside of a method. We need to talk about the classes, methods, and data fields instead.
Also, when you post code,
you should use
UBB Of course, this might not be the best way to do it. I think we need to discuss the design further before we go into implementation details like this.
I have one last general comment about your code. It is customary to declare variables when they are first used, especially with for loops. For example, I think you should change
to
This typically makes code much more readable. It also helps you to avoid reusing variables when you shouldn't.
Layne