This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Arrays and objects....  RSS feed

 
Kate ryan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I'm trying to write a program which reads in a sequence of lines, containing a name and telephone number and sorts it into an alphabetically ordered telephone directory. I was just wondering if anyone would be able to tell me how I could read in an unlimited amount of input...??
Thanks in advance...
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can't just read in an unlimited amount of input. There are system and memory limitations depending on what you are running on. What you could do is read in a certain amount, process it, save it, and then get the next chunk.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using an array, which has to be allocated at a specific, fixed size, you can use a List (for example, java.util.ArrayList) which grows as needed. In JDK 1.5:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!