Results 1 to 4 of 4
- 01-02-2012, 07:24 PM #1
Member
- Join Date
- Jan 2012
- Posts
- 2
- Rep Power
- 0
Collection that handles a key of String?
I have a collection:
A 10.10
B 12.12
C 32.32
I will use the first field (letter) to look up the second field (number).
Nothing fancy, only 90 entries, no need for sorting. Entries will be hard-coded. not even a need to edit.
I can't find an example of a collection, dictionary, array, hash, etc. that accommodates Strings data type for the key.
Any suggestions?
- 01-02-2012, 07:45 PM #2
Re: Collection that handles a key of String?
All collections that take objects for a key can take a String.
I don't know of any that do not.
If you are getting errors, please copy and paste the full text of the error message here.
- 01-02-2012, 08:06 PM #3
Member
- Join Date
- Jan 2012
- Posts
- 2
- Rep Power
- 0
Re: Collection that handles a key of String?
Works perfect. Thank you very much. I found dozens of examples but every one used int for key.
Can I extend the question?
The objective is to convert the name of a piano key to its frequency. Collection Key is name of a piano key ("A4", "A#4" ... ) and Collection Value is the frequency (440.12, 452.34...). If data is 88 items, hard coded, added in alphabetical order by key, no additions or edits (read only) what is the best collection type?
Thanks.
- 01-02-2012, 08:11 PM #4
Similar Threads
-
A music collection printer, questions about 2 String toString methods returned maybe
By silverglade in forum New To JavaReplies: 10Last Post: 05-21-2011, 01:47 PM -
Stack (collection) to int via String
By aborgeld in forum New To JavaReplies: 7Last Post: 04-07-2011, 05:16 PM -
Counting vowles in a collection of String objects
By sunde887 in forum New To JavaReplies: 4Last Post: 01-18-2011, 07:22 AM -
JDBC using adapter (and connection handles)
By Gideonzx in forum Advanced JavaReplies: 1Last Post: 07-28-2009, 06:54 AM -
how can i deep copy objects themselves instead of handles or references.. ?
By ishakteyran in forum Advanced JavaReplies: 0Last Post: 12-28-2007, 12:25 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks