• Post Reply Bookmark Topic Watch Topic
  • New Topic

java collections  RSS feed

 
adebari olalekan
Ranch Hand
Posts: 61
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
created a program to receive input from user and store the input in a java collection but i don’t seem to find any method that does that either in BufferedReader() or Scanner().
i want the program to receive an input from the user and run it through the data in an set, or ArrayList, or map
 
Campbell Ritchie
Marshal
Posts: 56576
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither buffered readers nor scanners have methods to put elements into collections/maps. You can run a loop in which you add objects to your List, or you can use the lines() method to create a Stream<String>.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!