Campbell Ritchie wrote:Start thinking object‑oriented. What sort of object can you design which would contain those two numbers?
Campbell Ritchie wrote:Start by thinking object‑oriented. Create an object which will contain your two numbers. Delete stages 1 to 4 inclusive from your list.
Campbell Ritchie wrote:I mean the stage 1 to 4 of your original suggestion are no use.
The class you have quoted is pretty poorly designed. Why did you not call it Pair? Why didn’t you mark both fields final? Why hasn’t it got a constructor? Why does that List appear mysteriously in the middle of the class?
It looks as if you have got a fixation about putting things in Lists and you have not explained why you need Lists. Before you can write any apps, you need to work out what they are going to do. Draw a diagram of how those pairs are supposed to relate to each other. That will give you some idea about their relationships. Post the diagram if possible.
Consider Paul's rocket mass heater. |