public static void main(String[] args) {
List<Set<double[]>> trj= new LinkedList<Set<double[]>>();
Set<double[]> st=new HashSet<double[]>();
st.add(new double [] {1.0,2.0} );
trj.add(st);
Iterator it = trj.iterator();
}
怎么才能通过it把列表trj中的第一个集合set中的数显示出来。
------解决方案--------------------
public static void main(String[] args) {
List<Set<double[]>> trj = new LinkedList<Set<double[]>>();
Set<double[]> st = new HashSet<double[]>();
st.add(new double[] { 1.0, 2.0 });
trj.add(st);
Iterator<Set<double[]>> it = trj.iterator();
while (it.hasNext()) {
Iterator<double[]> itt = it.next().iterator();
while (itt.hasNext()) {
System.out.println(Arrays.toString(itt.next()));
}
}
}