我想知道这在Java中是否可行。我想按字母顺序将其插入正确的位置。例如,LinkedList 的(假设它被称为coollist)元素是:[Dusty, Gordon, Mayer, Popovic, Zechariah] 我尝试通过执行以下操作插入另一个字符串:
coollist.add(d,Nyugen); //d is a a variable representing ant int which is the index
无论 LinkedList 中有什么,我该怎么做才能使 d 成为按字母顺序插入它的值?你们能帮帮我吗?我希望这是有道理的。