Results 1 to 3 of 3
  1. #1
    Andie is offline Member
    Join Date
    Mar 2012
    Posts
    8
    Rep Power
    0

    Default Sorting Text Files

    Does anyone have any suggestions on how to sort a text file through java? I'm not asking to make a whole code up for me, just suggestions on what may help me to work on a code. Would I need to make another loop to sort the text file?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default Re: Sorting Text Files

    Quote Originally Posted by Andie View Post
    Does anyone have any suggestions on how to sort a text file through java? I'm not asking to make a whole code up for me, just suggestions on what may help me to work on a code. Would I need to make another loop to sort the text file?
    Store all lines of the text file in a List<String>; use the Collections.sort( ... ) algorithm to sort the lines and write the (sorted) lines back to a file.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Andie is offline Member
    Join Date
    Mar 2012
    Posts
    8
    Rep Power
    0

Similar Threads

  1. Sorting text in imported text file
    By ManInTheMiddle in forum New To Java
    Replies: 10
    Last Post: 03-23-2012, 08:19 PM
  2. Replies: 2
    Last Post: 04-27-2011, 04:09 PM
  3. working with files (text files)
    By itaipee in forum New To Java
    Replies: 1
    Last Post: 02-24-2009, 11:38 AM
  4. Behaving text files like binary files
    By Farzaneh in forum New To Java
    Replies: 2
    Last Post: 08-27-2008, 03:20 PM
  5. Text and image files within jar files
    By erhart in forum Advanced Java
    Replies: 8
    Last Post: 01-19-2008, 04:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •