Hiya i have an array of objects called messageArray which is created by converting an ArrayList to an Array
The array has objects in it each called message and a message is made up ofCode://Converts the ArrayList MessageList to an Array of Objects public Object[] convertToArray() { return messageList.toArray(); } public void printMessageArray() { //Creates an Array of Objects called messageArray Object[] messageArray = convertToArray(); //Loops around the messageArray and prints out its objects for (int i = 0; i < messageArray.length; i++) { String info = messageArray[i].toString(); System.out.println (info); } }Now i want to sort the new Array which i have created by the sender by using bubble sort but not sure how can any help ?Code:String sender, String subject, String content, int day, int month, int year, int hour, int minute
At the moe the print out isbut after the sort i wantCode:Jon, Tips for Travel, You should really....., Received: 24/9/2004 10:30am Ian, Subject 2, Content 2, Received: 25/9/2004 11:30am Bob, Subject 3, Subject 3, Received: 24/9/2004 1:30pm Harry, Subject 4, Subject 4, Received: 24/9/2004 2:30pmCode:Bob, Subject 3, Subject 3, Received: 24/9/2004 1:30pm Harry, Subject 4, Subject 4, Received: 24/9/2004 2:30pm Ian, Subject 2, Content 2, Received: 25/9/2004 11:30am Jon, Tips for Travel, You should really....., Received: 24/9/2004 10:30am


Reply With Quote


Bookmarks