JAvaの3つの方法で繰り返す
1086 ワード
String[] str = {"33","55","55","22","22","22"}; //
List list = new ArrayList();
for (int i=0; i
Integer[] nums = { 33, 20, 20, 33, 6, 8, 8, 7, 11, 12, 12 }; //
TreeSet hset = new TreeSet(Arrays.asList(nums));
Iterator i = hset.iterator();
while(i.hasNext()){
System.out.print(i.next()+" ");
}
String test = "100,120,166,1555,120,150,100"; //
String[] str=test.split(",");
List list=new ArrayList();
for (int i = 0; i < str.length; i++) {
if(!list.contains(str[i])){
list.add(str[i]);
}
}
for (int i = 0; i < list.size(); i++)
System.out.print(list.get(i)+" ");
}