Which collection shall I use ?

Hi every one,
I am just stuck with one problem , I want to have elements which can avoid duplicate and also maintain order. I am not able to find the solution...
Thanks in advance..

I am just stuck with one problem , I want to have elements which can avoid duplicate and also maintain order. I am not able to find the solution...Avoid duplicates => you want a set (mathematical concept), represented in the JDK standard API as interface <TT>java.util.Set</TT> (http://download.oracle.com/javase/6/docs/api/java/util/Set.html)
"maintain order" => you probably merely want a <TT>SortedSet</TT> (http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html)
Then browse the Javadoc to find one of the multiple classes that implement those interfaces.
J.

Similar Messages

  • Which collection shall I use (BlockingQueue or Synchronized List) ?

    I need to use a thread safe queue in my app that is under high contention - there are 8 producer threads (writing data to the queue) and one consumer (consumer is only one and it is fast enough). MAX size of the queue is fixed (configurable though). Producers keep adding and consumer keeps deleting from the queue. I want to know which collection/approach should be the ideal choice :
    1. ArrayBlockingQueue
    2. LinkedBlockingQueue
    3. LinkedList with synchronization impl
    4. ArrayList with synch impl
    Edited by: radiatejava on Feb 27, 2009 11:52 AM

    1. Yes, normal queue semantics are followed (ie data always removed from head and added at the end only).
    2. Saying that only BlockingQueue is the option is not correct. I can also opt for normal LinkedList and ArrayList with my own sync implementation like this :
    //producer side
    LinkedList Queue_ = new LinkedList();
    synchronized (Queue_) {
    while(Queue_.size() >= 10000) {
    Queue_.wait();
    Queue_.addLast(msgBuffer);
    Queue_.notifyAll();
    And similar thing can be done on the consumer side.
    3. Lastly, pls keep in mind that LinkedList or LinkedBlockingQueue impls wrap the actual objects to be addded into another Node class objects thus creating lots of extra objects that needs to be GCed as well, making the performance not as desired as we expect (extra time is spent on GC).
    I want to know if there is any performance comparision available between BlockingQueues and synch List implementations.

  • Which activity shall i use to initiate a documentum workflow under ecm connector.

    which activity shall i use to initiate a documentum workflow under ecm connector.

    That's not something supported out of the box.

  • Which BIOS shall I use for " K8T Neo -FSR"??

    I bought  a MSI K8T Neo- FSR board yesterday. But when I looked at the MSI web site I haven't seen ...FSR board, I only see ...FS2R board instead. So which BIOS shall I download and flash? There is also no any explanation about FSR. My board carries the BIOS V1.1. On the other hand it writes this informatin on the board; " K8t Neo 6702 rev. 1.0"

    ...here's the product page...I found it the other day but I can't remember how   ...got lucky, I guess...  
    ...BIOS version?..I've always used Live Update in Windows...just follow the directions to the letter...there are beta versions available in the forums...the current one is getting good reviews...

  • Which collection should I use

    As I'm scanning an XML file gathering anchors, I'd like to associate the data with the file the anchor came out of. So there could be multiple anchors associated with a file, and that same file name could be an anchor itself in another file. I'd like to print this information out later like so:
    link: mysite.com/mycontent.htm found in pages: index.htm, content.php, etc.
    link: index.htm found in pages mycontent.htm, content.php
    This is all basically an effort to find dead links or redirects on my web site. Yes, I know there are tools out there that do this, but I'm trying to create this and learn some Java at the same time. Not to mention this tool does a lot of other things specific to my job. So, any ideas on what I could use and how?

    Also check this out:
    http://java.sun.com/docs/books/tutorial/collections/index.html

  • Which 3G shall I use?

    Hi all, this is my first post on this forum and I am a new iPad owner and my first ever apple product and I am very impressed. This iPad is my girlfriends it's a 64gb wifi version but I am looking at getting myself a 64g 3G. I have seen that here in the uk the three network is offering the best price at £15 per month for 10g content. I am an orange user with my mobile phone but orange with the iPad seems expensive.
    Ant are you guys using? And how do you find it?
    Thanks in advance
    Message was edited by: Adie Hughes

    There's more to this than meets the eye.
    Biggest factor apart from cost is whether or not a network gives reasonable coverage in most places you'd want to use it regularly on the go, otherwise it's useless.
    I went with O2 as I get reasonable coverage on 3G for my iPhone and while not the best value, 3GB for £15 rolling monthly renewal with ability to cancel 24 hrs before seemed ok.
    I'm currently considering trying 3.
    O2 3G for iPad service has big shortcomings for me:
    Internet images (safari/e-mail links) are compressed by O2 servers and are extremely poor quality - full of artefact with reduced colour depth which really spoils the experience for me. I'm paying for 3GB quota - I want full quality images even if they use more of my data allowance.
    BBC iPlayer does not work on O2 3G currently.
    YouTube videos are extremely low quality over O2 - considerably worse than over wi-fi for the same content.
    Other posters suggest 3 does not compress images, and that iPlayer works, though YouTube quality may be reduced.
    Not sure about Orange/Vodafone, as few comments though I don't think Orange compresses images.
    One user noted a £150 'hidden charge' taken upfront by Orange, and he's still in dispute with them last time I read the thread - sounds like a one-off error but can't say for certain until he tells us the resolution.
    Also consider some of the plans include wi-fi access at one or more hotspots, some have none.
    I've already picked up a 3 microsim, but am put off by a convoluted setup process that sounds as though it's done via overseas call centre.
    AC

  • Which D2W shall I use ?

    I want to create a front end for a database holding information about different projects, the database will be simple and will be used on a web site people will be able to brows it on the web and an administrator will be able to add stuff. I would like the ability for record owners to alter just their own records but that is secondary, so would I use...
    Direct to web application
    Direct to web services application
    Web Objects application
    Display group application ?

    I am just stuck with one problem , I want to have elements which can avoid duplicate and also maintain order. I am not able to find the solution...Avoid duplicates => you want a set (mathematical concept), represented in the JDK standard API as interface <TT>java.util.Set</TT> (http://download.oracle.com/javase/6/docs/api/java/util/Set.html)
    "maintain order" => you probably merely want a <TT>SortedSet</TT> (http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html)
    Then browse the Javadoc to find one of the multiple classes that implement those interfaces.
    J.

  • Which system shall I use?

    anyone work inside sap knows which existing system has the MI SERVER COMPONENT installed?

    Hello Irene,
    MI 2.5 Server Component is shipped with WEBAS 6.40.
    You have to install ABAP and Java Stack. MI Server Part does not have to be deployed seperately. After installtion of WebAS 6.40 a few steps are nescessary. You will find them here:
    http://help.sap.com/saphelp_nw04/helpdata/en/bb/b670bbaa991845924982155b7c3726/frameset.htm
    In Mobile Engine 2.1 you also have to deploy the sync servlet and the Web Console to the J2EE on the MI server.
    This is not needed with WEBAS 640 and MI2.5.
    Regards
    Frank Brackmann

  • Which RFID shall i use??

    Hi ,
    I am a post grad engg student. I'm planning to build a RFID with WSN system that can monitor bus traffic inside spacious bus stations, and can inform administrators whether the bus is arriving on time, early or late. This information is then displayed on the
    different wireless displays inside and outside the bus station. I intend to keep RFID readers inside buses to identify stops [ the stops have tags]. the sensors[ zigbee transceiver/ or any transceiver to transmit to other transceivers to other nearby buses
    and ultimately this informatio goes to a central station.
    So
    1 ] which type of RFID reader [range and frequency]  would suit best to be kept inside buses to identify tags at stops???
    and
    2 ] which type of tranceiver [range and frequency]  would serve best to be kept inside buses to transmit and receive data???
    Can anyone tell the
    1] reception range of such readers and
    2] their respective cost and
    3] where can i get them?

    I am just stuck with one problem , I want to have elements which can avoid duplicate and also maintain order. I am not able to find the solution...Avoid duplicates => you want a set (mathematical concept), represented in the JDK standard API as interface <TT>java.util.Set</TT> (http://download.oracle.com/javase/6/docs/api/java/util/Set.html)
    "maintain order" => you probably merely want a <TT>SortedSet</TT> (http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html)
    Then browse the Javadoc to find one of the multiple classes that implement those interfaces.
    J.

  • Which collection to use in this case for best performance....

    i have two text files having 10,0000(aprox)
    phone numbers , i wish to compare both the files
    and write the matching numbers in third file..
    so which collection should i use to perform it..
    so that performance is best......
    plz send me the logic....

    > so which collection should i use to perform it..
    so that performance is best......
    Program to interfaces. That way, you can switch out implementations and test for yourself which performance is best in an actual production context. But first, write your program so that it works. Worry about refactoring for performance once your program is written and it works.
    > plz send me the logic....
    Give it a shot on your own first; we can help if you get stuck.
    ~

  • Report in which collect statement .

    report in which collect statement  is used and also its purpose.

    COLLECT
    Basic form
    COLLECT [wa INTO] itab.
    Addition
    ... SORTED BY f
    Effect
    COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internal table itab .
    If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain two entries with the same default key fields.
    If, besides its default key fields, the internal table contains number fields (see also ABAP/4 number types ), the contents of these number fields are added together if the internal table already contains an entry with the same key fields.
    If the default key of an internal table processed with COLLECT is blank, all the values are added up in the first table line.
    If you specify wa INTO , the entry to be processed is taken from the explicitly specified work area wa . If not, it comes from the header line of the internal table itab .
    After COLLECT , the system field SY-TABIX contains the index of the - existing or new - table entry with default key fields which match those of the entry to be processed.
    Notes
    COLLECT can create unique or compressed datasets and should be used precisely for this purpose. If uniqueness or compression are unimportant, or two values with identical default key field values could not possibly occur in your particular task, you should use APPEND instead. However, for a unique or compressed dataset which is also efficient, COLLECT is the statement to use.
    If you process a table with COLLECT , you should also use COLLECT to fill it. Only by doing this can you guarantee that
    the internal table will actually be unique or compressed, as described above and
    COLLECT will run very efficiently.
    If you use COLLECT with an explicitly specified work area, it must be compatible with the line type of the internal table.
    Example
    Compressed sales figures for each company
    DATA: BEGIN OF COMPANIES OCCURS 10,
    NAME(20),
    SALES TYPE I,
    END OF COMPANIES.
    COMPANIES-NAME = 'Duck'. COMPANIES-SALES = 10.
    COLLECT COMPANIES.
    COMPANIES-NAME = 'Tiger'. COMPANIES-SALES = 20.
    COLLECT COMPANIES.
    COMPANIES-NAME = 'Duck'. COMPANIES-SALES = 30.
    COLLECT COMPANIES.
    The table COMPANIES now has the following appearance:
    NAME SALES
    Duck 40
    Tiger 20
    Addition
    ... SORTED BY f
    Effect
    COLLECT ... SORTED BY f is obsolete and should no longer be used. Use APPEND ... SORTED BY f which has the same meaning.
    Note
    Performance
    The cost of a COLLECT in terms of performance increases with the width of the default key needed in the search for table entries and the number of numeric fields with values which have to be added up, if an entry is found in the internal table to match the default key fields.
    If no such entry is found, the cost is reduced to that required to append a new entry to the end of the table.
    A COLLECT statement used on a table which is 100 bytes wide and has a key which is 60 bytes wide and seven numeric fields is about approx. 50 msn (standardized microseconds).
    Note
    Runtime errors
    COLLECT_OVERFLOW : Overflow in integer field when calculating totals.
    COLLECT_OVERFLOW_TYPE_P : Overflow in type P field when calculating totals.

  • Which cable (original apple usb or bmw y) shall i use to connect my 4th gen iPod photo 60 gb to bmw f10 (with com box) is it going to work with the apple usb cable and how long does it take till I can access the 33gb content via the bmw display?

    Which cable (original apple usb or bmw y) shall I use to connect my 4th gen iPod photo 60 gb (old but still working ok) to bmw f10 (with com box), build december 2010 > is it going to work with the apple usb cable and if so, how long does it take till I should be able to access the 33gb content via the bmw display?
    Alternatively: How long does it take if I would have to use the bmw y cable till I can access the 33gb content via the bmw display?

    Which cable (original apple usb or bmw y) shall I use to connect my 4th gen iPod photo 60 gb (old but still working ok) to bmw f10 (with com box), build december 2010 > is it going to work with the apple usb cable and if so, how long does it take till I should be able to access the 33gb content via the bmw display?
    Alternatively: How long does it take if I would have to use the bmw y cable till I can access the 33gb content via the bmw display?

  • Basic Standard IDOC type v shall b using which is relevant to our scenario

    Hello Everybody,
    We need to use SAP ALE functionality to transfer the date instantaneously.
    The interface is designed to transfer ABC employee's attendance & absence data to XYZ SAP instance for time evaluation and payroll transferring.
    Can anybody let me know the general scenario v follow for this interface to happen.
    for e.g. :
    Start--> Remote system call > IDOC_INBOUND_ASYNCHRONOUS>Pass communication to the system > User ID validations-> Data in Control Records ---> ALE Services filtering --> Application IDOC saved in the Database ---> Process IDOC immediately ---> Run tht Report prgm RPTEXTPT --> Read Process Code from Partner Profile -> Posting Module-->END.
    I'm using the Business Object - BUS7011,
         Tables Ptex2000,PTEX2010.
    Do v follow the same scenario for the CATSDB to happen in both SAP instances.
    I want the Basic Standard IDOC type v shall b using which is relevant to our scenario of Payroll and Time Sheet Management.
    Plz let me know.
    Any pointers will be much helpful.
    ThankQ
    Rohini.
    [email protected]

    Solved myself.

  • Which order type gets collected and is used for forecast consumption

    Hi all,
    I would like to know which Order Types (transaction types) get collected into ASCP (appear as demand) and which Order Types are used for forecast consumption.
    I tried to find something in the user guides, but had not yet success :(
    What I want to do:
    1. decide which order types are collected or not
    2. decide which order types consume forecast or not
    Anyone any advices?
    Big thanks in advance,
    David.

    Hi,
    Rather speaking like Order types, we may use word Sales Order. ASCP will collect all the Sales Orders for which we need to intiate action for Supplies. How it is determined?. It is determined from SO lines where in we have So lines are scheduled(it is prt of Workflow action too) and It is flaged 'Yes' for "Visible Demand Flag" . This is what designed functionality. We do not care what type of order type it is.
    thanks,
    dr

  • Be grateful for your help with Photoshop Elements which I have been using for several years.

    Be grateful for your help with Photoshop Elements which I have been using for several years.  Does Elements need to have access to ‘My Pictures’ on Windows as when I remove Photos from ‘My Pictures’, Elements later, when backing up, gives a message that it is unable to ‘reconnect’ to the same picture on elements.  On other occasions when removing a photo from Elements catalogue I also get a similar message when backing up saying ‘unable to reconnect’.  1. Is there a relationship between Elements and My Pictures and is Elements dependant on    the Windows ‘My Pictures’? 2. Why does some photos in Elements in some cases cause them to multiply e.g. double; triple; quadruple; and on occasions even more?  Is there something I need to do to stop this or an easy way I can remove the multiples without spending hours doing it manually one by one?  Am I doing something wrong? My O/S is Windows XP SP2 and windows Vista on my Laptop.  I have been using Elements 5 and have just purchased Photoshop Elements 8.0. (Upgrade) and about to install it. Be grateful for any advice as I do enjoy using the program if only I can resolve this issue.  I am not a PC wiz and mainly use Elements to catalogue photos from which I compile collections and from them slide shows with music.  Any advice appreciated Sonny.t PS Have tried to post this previously but without success so hoping to see message appear and a +response

    The organizer doesn't care where you send your photos when you download them via the downloader or where they happen to be when you first bring them in if you use the Get Photos command, but once your pics are in the Organizer, you *must* move them from within organizer or it can't find them. You don't have to use My Pictures at all if you don't want to, but regardless of the folder where you put your photos, if you want them someplace else, you use organizer to do it.

Maybe you are looking for

  • How to get the query values from the url in a servlet and pass them to jsp

    ok..this is the situation... all applications are routed through a login page... so if we have a url like www.abc.com/appA/login?param1=A&param2=B , the query string must be passed onto a servlet(which is invoked before the login page is displayed)..

  • ITunes update problem leading to a Windows NTLDR error

    I also experienced the "MCVCR80.dll is missing" / "Error 7, Windows error 126" iTunes update error like almost everyone else.  I followed turingtest2's solution that has been posted in the countless threads on this problem (e.g. <a href="https://disc

  • Switch iPad mini to PAL output through Lightning HDMI?

    Hi, I want to use my iPad mini as a source to play my own backing footage into a TV studio. I'm using Apple's lighting to HDMI converter. When I hook it up to the Blackmagic TV studio it only works if I set the frame rate on the Studio  to 720p at 59

  • Iphone could not be restored error?

    Trying to do routine update on my iPhone 4.  Then was prompted to restore my phone to original settings. Went through 3 hours of that, then an error occured saying unable to restore the phone.  Now, I can't do anything with my phone.  Tried disconnec

  • How can I get the weather in my notification bar?

    How can I get the weather/stocks in my notification bar. I can't find anything.