Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > sorting linked list

Reply
Thread Tools

sorting linked list

 
 
qaz qaz is offline
Junior Member
Join Date: May 2011
Posts: 2
 
      05-25-2011
hello guys i wanna help

i have small Problem in my progamme

plzzzzz help me

i want make sorting for linked list
and i dont how can i do it

in Java


this my main class
Code:
import java.util.*;
public class Hospital {
     
    public static void main(String[] args)
    {
   LinkedList <Patient_Records> list = new LinkedList <Patient_Records>();
		  
AddList(list);
printList(list);
Collections.sort(list);
    }
     public static void AddList(LinkedList<Patient_Records> list)
    {
                list.add(new Patient_Records("Dr.Saad Kalid","Sunday","Ibrahim","Ahmed",109876543));

                list.add(new Patient_Records("Bader","Al-Subei","Dr.Aziz Nasser","Monday",123456789));

                list.add(new Patient_Records("Yasser","Al-Harthi","Dr.Hassn Hamad","Friday",1298733456));
    }
    public static void printList(LinkedList<Patient_Records> list)
{
   
    for (Patient_Records e : list)
                {
                   System.out.println(e.toString() + "\n") ;
                }
}
Code:
public class Patient_Records extends Hospital_Records implements Comparable 
{

    private String Dr_Name;
    private String Appoitments;

    public Patient_Records(String Dr_Name,String Appoitments,
            String Patient_fName,String Patient_LName,
            int recID)
    {
        super(Patient_fName,Patient_LName,recID);
        this.Dr_Name = Dr_Name;
        this.Appoitments = Appoitments;
    }

    public void setDr_Name(String DrName)
    {
        Dr_Name = DrName;
    }

    public void setAppoitments(String Appiot)
    {
        Appoitments = Appiot;
    }

    public String getDr_Name()
    {
        return Dr_Name;
    }

    public String getAppoitment()
    {
        return Appoitments;
    }

     public String toString()
    {
        return (super.toString() + "Doctor Name: " + getDr_Name() +
                "\nAppoitment on : " + getAppoitment());
    }
 public int compareTo(Object o) {


{
}
 
Reply With Quote
 
 
 
 
qaz qaz is offline
Junior Member
Join Date: May 2011
Posts: 2
 
      05-26-2011
plzzzzz guys help me
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Airplane Program with Linked Lists. The linked list portion is veryconfusing to me. jawdoc C++ 9 03-10-2008 03:38 AM
Linked list within a linked list joshd C++ 12 10-02-2006 08:57 AM
Linked list, New try (was:Linked list, no out put,help) fool C Programming 14 07-03-2006 12:29 AM
Generating a char* from a linked list of linked lists Chris Ritchey C++ 7 07-10-2003 10:12 PM
Generating a char* from a linked list of linked lists Chris Ritchey C Programming 7 07-10-2003 10:12 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57