• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

HashMap and finding index difference

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a program thats has a data file that contains different strings like
ATGTCATGG
ATGCGATGGGGGGTCGCCCC
ATGTTT
the out put would be for this
the closest two are 3 apart in length
their indices are 0,2.

And the code so far that i have writen reads the file and checks how long each of the strngs are and it gives me what order the string is in. i have all this saved into a HashMap becasue an array list can only hold one value and hash map can hold 2. but my problem is that i cant figure out how do get the difference between the strings. the program is sapoose to find the clostest 2 and see how much they are apart by. i dont konw what to do with the hash map, becasue i cant sort the values .....



thankx
[ edited to disable smilies -ds ]
[ November 28, 2004: Message edited by: Dirk Schreckmann ]
 
author & internet detective
Posts: 41502
881
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Imran,
You can sort the values by getting the values. For example, map.values() return a list you can sort. It's just the values though, so you would need to loop through again to get the key that goes with the value you are looking for.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the Intermediate forum...
 
reply
    Bookmark Topic Watch Topic
  • New Topic