Link to home
Start Free TrialLog in
Avatar of jambo69
jambo69

asked on

What collection should I use?

Hi,

I am trying to create a simple search engine and have got a crawler working that stores information of pages into a database. After the user inputs their search times I pull information out of the database and rank it with a certain algorithm. My question is this, I need to record certain information about ranking so I can produce the results ordered by their score. What woud be the best way to do this? I need title, description page and score to be stored for each page and for this information to be presented to me in order of score (highest to lowest).

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> sort it (using you compareTo() function)
= simply perform:
Collections.sort(yourList_of_X_objects);
Avatar of Webstorm
Webstorm

You can use a TreeSet : all elements are always sorted.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/TreeSet.html

Hi,

I think you could use LinkedList collection classes, and HashMaps along with it for faster data accesses.

http://java.sun.com/j2se/1.4.2/docs/api/

Regards,

Warturtle
Thanks for accepting.
That keeps us answering your questions in the future.
;°)