I am new to Java, I want to store an array of pair of doubles. My code looks like this:
import java.util.ArrayList;
import java.util.Map.Entry;
List
Is Entry
a class you defined? You instantiate it with new
.
Entry pair = new Entry(d1, d2);
Note I am assuming you defined a constructor that takes 2 doubles, and you have references for d1
and d2
.
I suggest you NOT use the Map.Entry
class. The semantics for that class are such that the values are a key and a value, fitting with the way Maps work.