Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2008

Tip: Looking for answers? Try searching our database.

FIFO Class in Java2?

Thread view: 
Hal Vaughan - 01 Mar 2008 00:53 GMT
For this project I'm restricted to Java 2.

I'd like to find something that's a cross between a HashMap and a FIFO
buffer.  I want to store objects by name, but when it gets to a certain
size I want to automatically drop the oldest one in the queue.

Is there any kind of data structure close to that?  Or are there a few that
would be easily combined to do that?

Thanks!

Hal
Jeff Higgins - 01 Mar 2008 01:17 GMT
> For this project I'm restricted to Java 2.
>
[quoted text clipped - 5 lines]
> that
> would be easily combined to do that?

LinkedHashMap since 1.4, be careful with the access order flag.
Roedy Green - 01 Mar 2008 02:17 GMT
>I'd like to find something that's a cross between a HashMap and a FIFO
>buffer.  I want to store objects by name, but when it gets to a certain
>size I want to automatically drop the oldest one in the queue.

see http://mindprod.com/jgloss/queue.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Hal Vaughan - 01 Mar 2008 02:27 GMT
>>I'd like to find something that's a cross between a HashMap and a FIFO
>>buffer.  I want to store objects by name, but when it gets to a certain
>>size I want to automatically drop the oldest one in the queue.
>
> see http://mindprod.com/jgloss/queue.html

Yeah, I saw that about your own implementation, but I was hoping that just
this once you missed something!  (BTW, the link the your implementation
links to the page, but the positional part of the link doesn't work.)

Oh, well.

I can do one, I just figured it was still worth asking, just in case.

The more I explore the Java API, the more I find there are data structures I
knew nothing about that would have saved me a lot of time if I knew about
them a few years ago!

Hal
Roedy Green - 01 Mar 2008 19:01 GMT
>> see http://mindprod.com/jgloss/queue.html
>
>Yeah, I saw that about your own implementation, but I was hoping that just
>this once you missed something!  (BTW, the link the your implementation
>links to the page, but the positional part of the link doesn't work.)

I am a bit confused here.  http://mindprod.com/jgloss/queue.html is
about Sun's multithread queue classes.

http://mindprod.com/products2.html#LINKEDLIST is about some very old
Java 1.0 code to implement a LinkedList. I wrote it before Sun came
out with any of their collection classes.

Where is this broken link posted?  What is the broken URL?
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.