I need to know how to sort my linked list "teams" below.
Code:
package linkorderedlist;
import java.util.*;
/**
*
* @author jason.gladfelder
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
LinkedList teams = new LinkedList();
Scanner scannerObject= new Scanner (System.in);
System.out.println("Input a team, then press enter, then its number of wins, then enter again.");
System.out.println("Only 4 teams permmitted, input done when finished.");
int teamwinA, teamwinB, teamwinC, teamwinD;
String teamA= scannerObject.nextLine();
teamwinA=scannerObject.nextInt();
String teamB= scannerObject.nextLine();
teamwinB=scannerObject.nextInt();
String teamC= scannerObject.nextLine();
teamwinC=scannerObject.nextInt();
String teamD= scannerObject.nextLine();
teamwinD=scannerObject.nextInt();
BufferedReader reader = new BufferedReader(input);
while (team!=done)
{
teams.add(teamA+teamwinA);
teams.add(teamB+teamwinB);
teams.add(teamC+teamwinC);
teams.add(teamD+teamwinD);
}
Collections.sort(teams);
for (String teamsh : teams) {
System.out.println("Grade = " + grade1);
}
// TODO code application logic here
}
}