File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Dynamic Arrays In Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Dynamic Arrays In Java" Watch "Dynamic Arrays In Java" New topic
Author

Dynamic Arrays In Java

Brian Mulvany
Greenhorn

Joined: Oct 19, 2004
Posts: 28
Hi
I have a set of Java classes that parse a website looking for cd's. The amount of cd's vary depending on the search. I want to be able to sort the search results by price, album, artist etc. I figure one way to do this might be to use a dynamic array to store the results. I dont know how to do one of these or where to start. Has anybody here got any useful guidelines or hints as to where I can go and start.
Thanks
Brian
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
If you need dynamically sized collections of things, I recommend you read the Collections Trail. I'm sure you will find some interesting stuff there on storing and sorting collections of objects.
Yevgeniy Treyvus
Ranch Hand

Joined: Mar 09, 2005
Posts: 48
Hey Brian,

I wrote a simple example for you that should get you started. But I think once you get into it, you will see that you will probably need to make improvements in order to make it useful in your application.



By the way here's the corresponding output:

Sorting by column 1 ...
[AbracadabraMagic Touch14.992003
, Matchbox 20Best Hits19.991999
, TitaniumsMetal Hits 10127.991967
]

Sorting by column 2 ...
[Matchbox 20Best Hits19.991999
, AbracadabraMagic Touch14.992003
, TitaniumsMetal Hits 10127.991967
]

Sorting by column 3 ...
[AbracadabraMagic Touch14.992003
, Matchbox 20Best Hits19.991999
, TitaniumsMetal Hits 10127.991967
]

Sorting by column 4 ...
[TitaniumsMetal Hits 10127.991967
, Matchbox 20Best Hits19.991999
, AbracadabraMagic Touch14.992003
]
[ April 01, 2005: Message edited by: Yevgeniy Treyvus ]

SCJP, SCJD
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Dynamic Arrays In Java
 
Similar Threads
HTML Parser
Search engines
How does Javaranch allow dynamic pages to be searchable ?
How to code search engine in java.
Ordering Search Results