Help with collections and hashmap
Hi, I'm fairly new to java, and I just screened for an internship at a local software development company.
My first task is to create a collection, probably an array of directories and to use a hashmap to store 10 of the directories. And to read the 10 names from a file in your temp directory. Implement a custom sort (like sorted by reverse order).
And i'm not quite sure what to do.
Actually, I'm completely lost.
Any and all help would really, really be appreciated.
Thanks.
[519 byte] By [
petemosha] at [2007-11-26 17:43:09]

# 1
> Hi, I'm fairly new to java, and I just screened for
> an internship at a local software development
> company.
> My first task is to create a collection, probably an
> array of directories and to use a hashmap to store 10
> of the directories. And to read the 10 names from a
> file in your temp directory. Implement a custom sort
> (like sorted by reverse order).
>
> And i'm not quite sure what to do.
your first task is to create a collection, probably an array of directories and to use a hashmap to store 10 of the directories. And to read the 10 names from a file in your temp directory. Implement a custom sort (like sorted by reverse order).
> Actually, I'm completely lost.
Open your eyes and you will see the light (or at least people won't notice you're asleep at your desk).
# 2
hi!
first of all u place ur directories in a newly created linked list as it is fast to access and the memory usage is optimum with linked lists
then u go with a new tree map and place the required directories in the above linkedlist in the new tree map.
as u know tree map is a sorted map ,u also have ur directories sorted depending upon the data present in directories.
otherwise u specipy a sorting definition in ur constructor for tree map and then the directories will be gotten sorted accordingly..
i think u got the answer ..elsewise please let me know
# 3
> first of all u place ur directories in a newly
> created linked list as it is fast to access
Fast under some access patterns, slow under others
> then u go with a new tree map and place the required
> directories in the above linkedlist in the new tree map.
So what was the point of the linked list again as against going building the map directly?
> i think u got the answer
I hope so cos he won't get it from this.
ejpa at 2007-7-9 0:11:20 >
