こんにちは、この並べ替えられていないオブジェクトのリストは、選択ソートを使用して並べ替える必要があります。しかし、私は並べ替えを使用する配列に順序のないリストを変換する必要があり、私はそれを設定する方法を知らない。その後、配列を順序付けられていないリンクリストに追加する必要があります。ここ並べ替えられていないリンクリストを並べ替える方法
LinkedUnorderedList <games> c1 = new LinkedUnorderedList <>();
// stack for the code 3
LinkedListStack <games> transactions = new LinkedListStack <games>();
//Stack for the copy
ArrayStack <games> copyA = new ArrayStack <games>();
Scanner fileScan = new Scanner(new File("input.txt"));
int code;
String name;
String rt;
String dev;
int year;
games obj;
games tobj;
while(fileScan.hasNext())
{
code = fileScan.nextInt();
if(code == 3)
{
name = fileScan.next();
dev = fileScan.next();
year = fileScan.nextInt();
rt = fileScan.next();
tobj = new games(name,dev);
transactions.push(tobj);
}
else
{
name = fileScan.next();
dev = fileScan.next();
//System.out.print("hello");
year = fileScan.nextInt();
rt = fileScan.next();
obj = new games(name,dev,year,rt);
c1.addToRear(obj);
}
}
System.out.print(c1.toString());
Iterator <games> cpy = c1.iterator();
games element;
while(cpy.hasNext())
{
element = cpy.next();
copyA.push(element);
}
cpy = c1.iterator();
while(cpy.hasNext())
{
info += cpy.next();
}
String ar [] = new String [c1.count];
for(int index = 0; index < c1.count;index++)
{
ar[index] = c1[index];
}
は、言語を指定し、彼らが知っている言語で質問を探してそのように人々は、この 'arrays'タグをお届けします非常に一般的で、好き嫌いがない –