Looking for the right List...

Hi there!
I want to use a List class to hold a potentially large number of elements. I don't care about randomly accessing elements; only Iterators will be used to iterate through the List. What I mostly care about is storage overhead and garbage collection.
ArrayList and Vector have the problem of re-allocating memory and copying their internal array as you add elements - in case you don't know the exact number beforehand, which is my case.
On the other hand, LinkedList creates a new object for each element you put in the List. All these objects will have to be garbage collected at some time, and this takes resources. In my case, I could have 10s or 100s of objects, each creating its own List with 10s or 100s of objects.
So, essentially, I'm looking for the best trade-off. Anybody done some stress-testing?
Thanks a lot!
Vagelis

Well... it depends.
If you know up front how many entries there are going to be in each list and the lists are fairly stable then you'd be best off going with an ArrayList. If there's a lot of addition and removal of items in the list and you have no clue how many objects there are going to be in each list, then you might be better with a LinkedList. It may also depend on how you remove entries from the list (by index or by object value) or whether you just throw a whole list away and start again.
Personally I've used ArrayLists of ArrayLists containing 10s or 10000s of objects and "been okay", by which I mean this has never been the performance bottleneck in my system.
In extremis (particularly if performance is really critical and you know quite a lot about how your objects are to be organised) it might be more sensible to roll your own implementation (for example, if an object appears only in one list at a time then it could be made "Listable" and hold its own forward and backward references to aid in its insertion in a linked list).
If you can give some more information on the exact required behaviour then people can help more.
In the meantime my recommendation is to use an ArrayList and if performance becomes a problem, profile the execution later and consider switching.

Similar Messages

  • Looking for the right application.

    What is the equivalent of the Notepad on the Macbook Air?

    I am supposing you are looking for a text editor, and NOT a word processor.
    I was one looking for an equivalent, and found some difficulty in finding one. IMHO, Apple devastated TextEdit with the advent of Lion. They added "features" which removed its ability to act as a simple text editor. For a while, I simply installed a copy of the Snow Leopard version, but was on the lookout for a super-simple editor for editing txt files, and not adding any formatting, paragragh styles and other features which can ruin batch and text files. I also did not want anything which littered the disk with "versions".
    If you are truly looking for the closest equivalent to "Notepad", I have found an app in the Mac App Store, curiously called "Notepad", a simple TXT Editor By Kupon.BG Ltd. It is even better than Apple's old editor.
    Just do a search within the app store for "notepad", and select the first entry...the one by Kupon. Or use this link.

  • Nw8440 northbridge issue, looking for the right mobo replacement

    hi,
    i'm my nw8440 mobile workstation (T7400, FireGL V5200, 15.4" WUXGA) seems to have some northbridge issues and i'm looking for mobo replacement.
    As i can read from "Maintenance and Service guide" it does share the same mobo (SPS 416397-001) with nc8430 and nx8420. But is it really the same? Because my nw8440 is equipped with a soldered gpu FireGL V5200 instead the other ones have a X1600.
    thanks,
    This question was solved.
    View Solution.

    Hi @macrionitis ,
    Thank you for visiting the HP Support Forums. I needed to edit your post and remove the image with the Serial Number. In accordance with our Rules of Participation:
    Protect privacy - yours and others'. Don't share anything about yourself that you would not want to see on a road-side billboard. Don't post contact or other personal information-your own or anyone else's-or any content that you receive in one-to-one communications without the author's consent. For example, don’t post your computer’s serial # or contact information publicly, and do not allow someone you don’t know to remotely take control of your computer.
    If you need people to contact you directly, either ask them to send you a private message or subscribe to the thread so you will be notified when there are replies. You may also click on your name anywhere in the forum and you will be taken to your profile page, where you can find a list of threads you have participated in.
    Sharing personal email addresses, telephone numbers, and last names is not not permited for your safety. If you have any questions feel free to send me a private message in reply.
    Thank you
    George
    I work for HP

  • Looking for the right forum

    I have a question about a web application I am working on using ASP.Net, MVC and Razor. I can't find the right forum. When I looked at the .Net forums none of the questions asked there looked even remotely like what I needed.
    I have classes in C#, Views and Controllers and have HTML 5 mixed with Razor to get the views to work.
    Scott

    Thanks for the reply. I use that forum. I thought it was different from the rest of the MS forums. Unfortunately sometimes someone will answer a question with a meaningless response, but it appears to have been answered by others and is ignored from that
    moment on even when you ask for clarification. MikesDotNet is the only one I have had respond in a clear and concise manner, but I imagine he works too and can't be counted on for every question. The Microsoft information is sometimes helpful, but many times
    does not address the actual issue for which we ask for help. In this particular case I need info on entering time in hours and minutes for an Int64 property. If you try to find it on Microsoft your eyes cross because nothing is said about hours and minutes
    except as a part of the DateTime. If there is some correlation then it escapes me and that means Microsoft's information is unclear or incomplete.
    Oh well, back to ASP.Net. Thanks again.
    Scott

  • Looking for the right container

    I hope I can describe this accurately. I am looking for a
    container similar to a panel, but with its right border
    transparent. The appearance I hope to achieve is something like a
    sidebar which will slide from the side of the parent control panel
    on creationComplete.
    Any ideas of a possible container would be
    appreciated.

    Or if you like it quick and dirty you could mess up a Panel
    by adding a mask to it; something like this:
    <mx:Canvas id="mySliderThingy" left="50" top="20">
    <mx:Panel height="120" title="Something panel-ish"
    mask="{themask}">
    <mx:Label text="Perhaps not the best idea of all times,
    but still..." />
    </mx:Panel>
    <mx:Canvas id="themask" left="10" height="100%"
    width="100%" backgroundColor="#123456" />
    </mx:Canvas>
    Probably not a very GOOD idea, but it is an idea... ;-)
    hth / Culme

  • Looking for the right adobe solution

    I'm looking for a solution I'm sure resides in the Adobe suite of products but am not sure of the best program(s) to use. I want to create a cross platform GUI menu for content CDs. The content is not active multimedia content, but mostly PDFs of print publications. Most users will be on Windows, but the result should, in good conscience, be cross platform. Since many of the users will be on computers that prohibit autorun (i.e., gov't), I want to also configure it to not leave the user in the lurch because they can't autorun. I hate it when that happens--staring at an explorer/finder window full of unintelligible files, not knowing where to start.
    An interactive PDF, built in InDesign, with links established to source PDFs in a designated folder? Any prospective user is going to have Acrobat, if only Reader. I'm a print designer and when I step off into the multimedia, interactive thing, I lose my bearings. There are so many great tools in Adobe, I want to go down the right trail and not off a cliff.
    Thanks.

    Thanks. I will look into that. In fact, my portfolio is an interactive PDF. Wth the increased interactive components in CS5, I thought there MUST be an Adobe solution. I supposed one might be able to create links from a menu design to the many PDF-publications in a folder like a TOC link would do. The folks, very nice I might add, who work in IT where I work are on the Windows/Sharepoint kool-aid diet. I do not think they see Adobe as a solution for ANYTHING. All I want to do is help produce a functional, professional product. I not sure it's necessary to the Encore-level product, especially if the content is not active DVD content.
    Thanks very much. I really appreciate your response.

  • Looking for the right preset

    Greetings -
    I just recently purchased CS5 Production Premium and I want to use Premiere to create slideshows with still camera shots.
    My source is RAW images (.NEF). I process them in Lightroom 3 and I export them in .Tif or .Psd formats ranging in size from 1920x1080 to 4288x2412 for use in Premiere.
    The goal is to produce mpeg2 files that can be played on a Western Digital TV Live HD Media Player on rather large HD 1080p TVs (52” – 55”). The mpeg2 files that I have produced with other programs are either 24 or 29.97 frames per second with data rates of 30mbps and appear very good on the equipment described above.
    I do a lot of zoom and pans and add sound to these slideshows.
    I am looking to produce the slideshows with the highest clarity and smoothness possible.
    The question I have is: What Premiere sequence preset is the best choice for this kind of application?
    Any thoughts, suggestions or tips would be greatly appreciated.
    Thanks!

    Thanks for the fast response.
    The WD will handle 1920x1080p which matches my HD TVs.
    Looking at the choices presented for presets I see that the following have 1920x1080p settings:
    AVCHD
    Canon XF Mpeg2
    Digital SLR
    Red R3D
    XDCam EX
    XDCam HD422
    In respect to video is there one of the above that is more suited for stills?
    Thank you Bill for all of your help.

  • Looking For the Right Lens

    Hello, I am a casual photographer and really just learning this great hobby. I got into it trying to get good pictures of my daughters during their ballet performances. Each step I've taken has got me a little closer to getting good pictures of them but I'm quickly running out of time. My last step was to purchase a T4i. I mainly use the kit lens 18-55 for most of the shots of them and sometimes the 55-250 if I want to get close in. I generally crank up the ISO so I can use a faster shutter speed. I find that ISO 6400 with a shutter speed of 1/400 in general is giving me the best results but not anywhere near perfect. I've pinballed around looking at lenses and my head is swimming and frankly I don't know enough to make a great desicision. The current lens I'm looking at is the Canon EF 24-105 f/4 IS USM. The other two lenses I own both go to 5.6 and I was hoping the fixed f/4 would let in more light letting me reduce the ISO for a less grainy picture. Going back and looking at most of my shots I'm usually in the 30-50mm range but that can change depending on where I get to sit at each show so a zoom lens is mandatory for me. I really want to stay around $500 to $600 if at all possible and think I can get that lens at that price range.
    My second use for the camera is to film my younger daughter singing at different school or social events with an occasional picture thrown in. Would the above lens work well for that? The current  lens choices I have suck. They are noisy and hunt for focus. I've heard rave reviews of the kit lens 18-135 STM for it's fluidity of movement in almost comeplete silence. I got to play with the lens a few weeks ago at a party when someone asked me to take some pics with their camera. I marveled at the speed and silence of the focus motor. I believe the f stops on it are the exact same as my current lenses though. So If I get it as well I'm guessing I'd be in the same boat as above but with better video. If I do get this STM lens would I get the same quality pics as the kit lens I have now or is it a little better than my current  set up? The person who's camera I borrowed loved it but they aren't a photographer by any means. Any recomendations here are appreciated as well.

    OK let's give this s go.
    If you are shooting a f5.6 at ISO 6400 and you decide to get an f4 lens, you will be able to shoot the same scene at ISO 3200. That lens is one stop faster.  Not a big deal.   But, on-the-other hand if you got a f2.8 lens you are talking another stop off.  The ISO would now be 1600.  Pretty good, I'd say.
    Unfortunaltely an f2.8 lens isn't going to be cheap. Sigma has a 17-50mm f2.8 and even better a 18-35mm f1.8.  The f1.8 will allow you to drop more than another stop off your ISO to around 640.  Generally speaking the lower the ISO, the less noise in the photo and the better it will look.  But these are a little short of the mm (focal length) you say you need.
    Any of these lenses, and the outstanding EF 24-105mm f4 will make way better pictures than your current kit lenses do. Tamron also has some choices in this area, too.
    The ideal choice would be a 24-70mm f2.8 but they are going to be way more expensive.  The Sigma being the cheapest in this bunch, again.  The Canon EF 24-70 f2.8 L IS being the best lens there is, period, and a price tag to prove it.
    The EF-S 18-135mm is a better lens than what you have but is not going to help the ISO problem.  You need, one, more light on the subject or, two, a faster lens.
    Another idea!
    If you can live with a fixed focal lemgth, or prime, lens, you could get the EF 50mm f1.8 or better yet the EF 50mm f1.4.. Now were're taling. f1.4 is four stops faster and your ISO would drop to 400.  Around $110 bucks and $350 respectively.  Sound good?
    There are some more prime lens choices for you.  Get on the Canon web site and gaze at the primes and see if one or two might just fill the bill.  The primes also have the advantage of being outstandingly sharp.  Light years ahead of your kit lenses.
    Sigma has some great primes, too.
    EOS 1Ds Mk III, EOS 1D Mk IV EF 50mm f1.2 L, EF 24-70mm f2.8 L,
    EF 70-200mm f2.8 L IS II, Sigma 120-300mm f2.8 EX APO
    Photoshop CS6, ACR 8.7, Lightroom 5.7

  • Looking for the right program

    I would like to make a stop-action movie, essentially a slide show with some rapid frame changes, that has a coordinated sound track.  Which Adobe program, if any, would do this?

    That is a pretty big project. I have never used Premiere Pro for only pictures so I don't know how good it will be at this. 3000 pictures/30gigs is a lot of data for a program to handle and organize. And if you also want to add contextual content and audio clips then a lot of easier to use programs just won't cut it. You might really need an Adobe program.
    It if was a small onetime project I was going to suggest Corel VideoStudio, but definitely not for the amount of data you want to use. http://www.youtube.com/watch?v=mC88QA7xyyE. For really small projects Windows Movie Maker would probably do the trick haha.
    Most stop-motion software are designed to help you with the actual shooting of the frames, but you already have them. You still might want to look at these two programs to see if they'll work for you.
    http://www.dragonframe.com/
    http://www.stopmotionpro.com/
    Just because they might be better at organizing large amounts of pictures then a program designed around editing video.
    If Premiere Elements would do the trick I'd say that's a good option, or if it's too limited Premiere Pro. I'd go with the CS6 version, not CC. Because you get to keep a perpetual license so you can continue to use it in the future without monthly payments. But that's my biased opinion against renting software.
    This thread should probably be moved to the Premiere Pro section where he can get better help from people who have more experience with using large amounts of pictures to create a movie.

  • Looking for the right KVM drawer and switch for SUN Fire v240 and v880

    Hi,
    We have Sun Fire v240, v880, and four dell servers in a Shark Rack. The LCD monitor and keyboard drawer and the KVM switch were part of the original installation from Shark Rack. The switch and the monitor stop responding from time to time so I am looking for a replacement.
    I am surprised that the prices for the KVM drawer are very different from different manufactures. I was just wondering whether I really need a SUN ready certified KVM drawer. If anyone has any experiences(good or bad) with getting a new KVM, please share it with me.
    If the KMV drawer is compatible with SUN systems, do I need to install any patch on the system or it's simply plug and play?
    Thanks!

    For most SPARC based Sun Servers you do not need a KVM switch, but merely a terminal switch which you can attach to the console port of the Sun Server. There are plenty of Terminal Servers to choose from, the most recent i bought was a Cyclade, which works very well and allows you to ssh to a console..
    .7/M.

  • Looking for the right agenda

    hi people, I'm looking for an agenda where i can put more people in at once fore my business and when one of my jobs falls out that the agenda adapts. Can anyone help me? grts Johan

    Okay installed Microsoft office 2013 and then used that to make a sync and it workt
    but i lost loads of events whille syncing the calander :'( any way to get them back ?

  • Looking for the right manual...

    I am looking at the possibility of delivering dynamically generated reports over our intranet, and have unearthed the documentation on WedDB, which may be a good solution for my problem. However I cannot find the installation documentation for WebDB on Solaris, and was hopeful that someone might know the location of a guide or walkthrough.
    The system in question is an Oracle 8i database running on Solaris.
    TIA.

    Although we do have a 9i database one one of the machines, we do not have 9iAS (unless I have missed something here) or any licenses for it.
    WebDB looks like it will do everything I require, as well as being covered under the 8i license AIUI, so my prefered option, at least initially, is to ge going with that and then look at 9iA if it can't cover all the requirements. I have now found the installation guide, but can't find any WebDB CDs here, or a download on the otn.
    Thank you for the information about the AS portal system, but shoud you have a CD devining rod or a link to a WebDB download I would be even more greatful :o)

  • Looking for the right audio adapter

    I thought the Griffin iMic was my solution until I read the specs closer.
    I am looking for an adapter that can handle things like a profession quality microphone and even an input for my guitar (same jack acually).
    I am seeking advise on how to accomplish this with a spending a zillion $$$
    I realize this will likely involve more than one piece of hardware.
    Any and all advise on this matter is GREATLY appreciated.

    http://www.bulletsandbones.com/GB/Interfaces.html

  • Looking for the right CS5 format

    What is the right Dreamweaver CS5 format for creating a non-changing page with 12 changeable photos? Would a template be best? Or?

    Is this the model Powerbook you have?
    http://www.apple-history.com/?page=gallery&model=pg4_15167&sort=family&performa= off&order=ASC
    I ask because it has a cd burner built in:
    Optical Drive: 24x/24x/16x/8x CD-RW/DVD-ROM or 24x/24x/10x/8x/8x/4x CD-RW/DVD±RW
    If however, you need a second burner, I can recommend La Cie, but there are tons of other brands that will give you the same functionalities for about the same price.
    http://www.lacie.com/us/products/range.htm?id=10014

  • Looking for the right collection for a specific problem

    Hi guys,
    Just wanted to say great work you guys are doing here. the forum has definitely helped me a lot in the past.
    I am currently having a problem selecting a collection for this specific application that i have to do for my final year project. I am looking for a way to store a bunch of strings a collection that uses the actual string as its key and stores the number of times that the string have been added to the collection as its value.
    so for e.g
    String a = "a";
    String b = "b";
    String a2 = "a";
    String c = "c";
    /**Here is where i create my collection */
    // Collection mycollection = new collection
    // mycollection.add(a);
    // mycollection.add(b);
    // mycollection.add(a2);
    // mycollection.add(c);
    /**if you request for the string a or a2 the collection should return the number of times that string appead e.g */
    // System.out.println(mycollection.get(a));
    //this should print 2
    Does such a collection exist? I remember using something similar when i was learning c++ but i havent been able to find what i am looking for in the API documentation. Please help.
    Frank

    I think what the OP is looking for is probably a Bag. Unfortunately the default collections framework does not provide a Bag interface or implementation. You could look into using the Jakarta Commons Collection, they do provide those (look at the API[url] as well.

Maybe you are looking for

  • Itunes crashes when I try to update the songs on ipod

    I have a G4 running the newest update and also itunes 7.0.1 This is what is happening: I start itunes, plug in my ipod. The ipod screen within itunes comes up and then I click on the tab at the top labled music and itunes chrashes every time. How am

  • PROBLEM WITH PLACEMENT OF BOUGHT TUNES

    When I buy tunes, alot of times, it will be listed in my library and not in my purchase music playlist. What's up?

  • Can't watch videos, get a green screen only

    Hi, I can watch videos with MSN, but when I try to watch you tube, cbs or any other site,  get a green screen. I've enable flash and shockwave but still nothing. Help!

  • AVCHD Video in PE7

    I just recently purchased a Sony HDR-SR11 Camcorder which produces great HD quality video in the AVCHD format. Having just upgraded to Premiere Elements 7, I was really looking forward to editing my high-def videos but have run in to trouble. The cli

  • Final Cut Pro 10.1.2 - Continuous Viewing of Clips

    I am attempting to make the switch from iMovie to Final Cut 10.1.2 and all is going well except for viewing of events.  I make highlight dvd's of my sons sports seasons.  In iMovie I am able to continually view all clips in the event.  It automatical