• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Chat Program in Java

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doing chat program in java.I created the txt file and stored all the users name in that using random acces file.Now I want to sort all the usernames before retriving that one from that file.Is there is any simplest method to do this.While I'm doing this it is getting slow.Since I'm reading the usernames one by one and sort it and then retiving again one by one.
Help me Guys!
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use BufferedReader to make it fast.
I'll suggest u to read all the data in the file in the 1 time. and then perform sorting and then rewrite the whole file by writing the sorted data.
I think it should do
===
FAF
 
Faisal Farooqui
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use BufferedReader to make it fast.
I'll suggest u to read all the data in the file in the 1 time. and then perform sorting and then rewrite the whole file by writing the sorted data.
I think it should do
===
FAF
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The above reply is right.
Read all names into TreeSet. object which will automatially sort the names in ascendig order.
Cheers
Binu
 
We begin by testing your absorbancy by exposing you to this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic