我为示例自定义了字符串数组:
String[] myArr = {"Zen", "Maruthi","Swift", "Audi"};
我有一个工具可以生成类似的数组
String[] output = getCars();//returns {"Swift", "Audi", "Zen", "Maruthi"}
// it should return same as myArr...means {"Zen", "Maruthi","Swift", "Audi"}
我想将输出数组排序到myArr;我正在使用 for 循环与myArr 比较进行排序;
那么还有其他方法可以对自定义数组进行排序吗?请帮助我