Array Sorted why it would not work. JAVA. public static ArrayList<Term> organize
ID: 3727525 • Letter: A
Question
Array Sorted why it would not work. JAVA.
public static ArrayList<Term> organizePrefixOrder(ArrayList<Term> a, ArrayList<Term> b) {
for (int i = 0; i < a.size(); i ++){
for (int j = 0; j < i; j++){
if (a[i].compareTo(a[j]<0)){
String ch = a[i];
a[i] = a[j];
a[j] = ch;
}
}
}
for (Term term:
array) {
b.add(term);
}
return b;
}
Array list a has inside it
BB, BA, BC, AA, ZZ
Array list b has nothing inside it.
I want that array list b has sorted version of array list a
so AA, BA,BB, BC, ZZ
Explanation / Answer
----------------------------------------------------------------------------------------------------------------------
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.