Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Map Application examples  RSS feed

 
rosso bianchi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

Am new to the forum, having been a long time lurker. i am looking for some help regarding a scenario I need to come up with to create a basic map application

I need to come up with a scenario for small application that makes use of a map and provides the user with the ability to store, manipulate and extract data.

The type of map can be(sorted or unsorted), the keys must be of type String or Integer. The values must be of a collection type from the Collections Framework.

Ideally I am looking for only one class and for it to be really basic, My mind is at a complete blank, I would appreciate a few points in the right direction, I am very new to java as this post probably show lol

Any help would be greatly appreciated.

(Go easy on me)

 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, Welcome to the Ranch. We always go easy on greenhorns, so don't worry.

Is your "blankness" about how to use maps in Java? if so, this tutorial should help. Or is it about how such a map might be used? What about how to structure that would track the books a person had? The key would be the person's name and the value would be a list of books.
 
Campbell Ritchie
Marshal
Posts: 55681
162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Key=name, Value=address.
Key=name, Value=phone number.

There are two more simple uses.
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but "the values must be of a collection type from the Collections Framework," so I suggested a list.
 
Campbell Ritchie
Marshal
Posts: 55681
162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I missed the bit about a Collection. Sorry. Can you create such a Map with a Stream? It turns out to be very complicated, taking a total of three lines to write here.
 
rosso bianchi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies
 
rosso bianchi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to come up with something in relation to the sporting world
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!