does it matter qua speed or memory
in
Programming Questions
•
1 years ago
I have a simple class like this:
The fatalityIds, can hold now the id of the Fatality object. I was wondering, in what aspects does it matter if it holds the Fatality objects instand of the id of it? (it doesn't have to store a copy, just a reference to the original)
so this:
public ArrayList<Integer> fatalityIds = new ArrayList<Integer>();
will become:
public ArrayList<Fatality> fatalitys = new ArrayList<Fatality>();
- public class Day {
public int count;
public Date date;
public ArrayList<Integer> fatalityIds = new ArrayList<Integer>();
Day(Date date) {
this.date = date;
count = 1;
}
public void count() {
count++;
}
}
The fatalityIds, can hold now the id of the Fatality object. I was wondering, in what aspects does it matter if it holds the Fatality objects instand of the id of it? (it doesn't have to store a copy, just a reference to the original)
so this:
public ArrayList<Integer> fatalityIds = new ArrayList<Integer>();
will become:
public ArrayList<Fatality> fatalitys = new ArrayList<Fatality>();
1