Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
980 B
0
Indexable
Never
public void SortRecord(ArrayList<MaltesePlayers> F) 
    {
        int len = F.size() - 1;
        boolean sortflag = true;
while (sortflag) 
                    {
                        sortflag = false;
                        
                        for (int i=0; i<len; i++)
                        {
                            MaltesePlayers f = F.get(i);
                            MaltesePlayers f1 = F.get(i+1);
                            
                            if (f.getSurname().compareTo(f1.getSurname()) > 0)
                            {
                                F.set(i,f1);
                                F.set(i+1,f);
                                sortflag = true;
                            }
                            len--;
                        }
                        JOptionPane.showMessageDialog(null, "List has been sorted successfully", "Sorted", JOptionPane.INFORMATION_MESSAGE);
                    }
}