If anyone could tell me whether my code is redundant (and if it is, possible solutions to eliminate redundancy) I would very appreciate it.
public class Question {
private Queue<Double> a;
public Question(double XXX) {
a = new LinkedList<Double>(); // REDUNDANT?
......
}
public Question(double[] YYY) {
a = new LinkedList<Double>(); // REDUNDANT?
......
}
}
Basically, one constructor takes in a double value while the other constructor takes in an array of double numbers. Is there any way to instantiate the Queue
only once?