当前位置: 代码迷 >> J2EE >> 关于List<set>求教,该怎么处理
  详细解决方案

关于List<set>求教,该怎么处理

热度:616   发布时间:2016-04-17 23:46:20.0
关于List<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 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()));
}
}
}
  相关解决方案