Adding to a List which is being looped?

Hello,
I am trying to add items to a list which is being looped.
Here is a demostration of what I want to do.
List<MyObject> myObjects = new ArrayList<MyObject>();
myObjects.add(new MyObject());
for (MyObject mo : myObjects) {
        if (mo.process()) { // assume 'true' for couple of loops
            MyObject mo2 = (MyObject) mo.clone();
            myObjects.add(mo2);
}I know I could keep a seperate list and then addAll to the myObjects list but that is not an option in my case. (code above is just a sample).
And I also don't want the items to be added to the list after the for loop is existed which I think will happen if i do the list synchronized. (correct me if i am wrong please).
Is there a way for this?
thanks.

This is a hard one. What you say you want can't be done with the new for loop nor with an iterator. You'll have to find a different way. If you know exactly what you want, there'll be a way to obtain it.
Why is it that you cannot use addAll() or another means to add the elements after the loop?
In your loop, do you want to loop through the added items too?
I never used a ListIterator, but I think it has a few more options than the plain Iterator. Did you look at that yet?

Similar Messages

  • Adding hyperlink in Infopath custom list which opens pdf document available in document library

    Hi,
    I have a custom list(modified in InfoPath 2010) and a document library having 2 pdf documents.
    In the Custom list, i have used the attachment option for another field.
    How to create a link in the InfoPath list, which when clicked opens the corresponding pdf from the document library?
    How to achieve this?
    Thank you

    Hi Venkatzeus,
    From your description, you have a list and attachments for the list are uploaded to a document library. To display the hyperlink in InfoPath form, you can directly use 2 Hyperlink controls. And give the document' URL in this control using formula.
    I’m not sure how you upload the list item attachments to another document library. But make sure you have made a connection between the list item and attachments in document library. Here is an example.
    ListTitle         ID
    Item1     1
    Item2     2
    Pass the ID to the document library when we create the attachment.
    Document Name             ItemID
    attachment1 for item1    1
    attachment2 for item1    1
    attachment3 for item2    2
    attachment4 for item1    1
    attachment5 for item2    2
    So here, we can see attachment1, attachment2, attachment4 are item1’s attachments and attachment3, attachment5 are item2’s attachments, because of ItemID.
    1. Create a new column for document library, named it DocumentURL.
    2. Create a workflow and set to start when new item is created automatically with following action.
    Set DocumentURL = http://server/topsite[%Current Item:URL Path%].
    3. Custom list form.
        1) Add a data connection to receiver data from document library.
        2) Insert document library connection as repeating section.
        3) Add a hyperlink control within the repeating section (Insert > Hyperlink).
        4) Select DocumentURL as the data source for Link To and Display options.
    4. Add a formatting rule to the repeating section control.
    If ItemID in document data connection is not equal to ID in Main data connection, then hide this control.
    5. Done.
    Let me know if you have any question.
    Thanks & Regards,
    Emir
    Emir Liu
    TechNet Community Support

  • Maximum number of records which can be added to custom list

    HI,
    What is the maximum number of records added to custom list, without increasing the list throttling?
    Thanks

    its two differnt thing you are asking.
    1) Max Number of Record MSFT supported is 30,000,000 per library/List
    http://technet.microsoft.com/en-us/library/cc262787.aspx#ListLibrary
    For List Throttling.
    To minimize database contention, SQL Server often uses row-level locking as a strategy to ensure accurate updates without adversely
    impacting other users who are accessing other rows.
    check this one to understand more about throttling.
    http://blogs.msdn.com/b/spses/archive/2013/12/02/sharepoint-2010-2013-list-view-lookup-threshold-uncovered.aspx
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • I don't accept cookies except from "Exception" domains. However, it seems that any site that want to set a cookie is automatically added to my list of "Exceptions". Why is this?

    I have "Accept cookies from sites" unchecked. I have a list of exceptions for domains that I allow to set cookies. However, it seems some site not on my exception list are automatically added to my list when they want to set cookies.
    Why/how is this happening?

    Hello cor-el, thanks for your reply. I changed my settings for downloads to desktop and it has appeared on there. When I double click I am asked which program I want to open file. I click firefox and another box "opening install" says I have chosen to open the file which is an application and do I want to save it. This is the only real option so I press save file. I get a box saying this is an executable file which may contain viruses - do you want to run. I press ok and the final box showing C drive file name and desktop appears stating application not found.
    This happens the same whenever I try to install.
    To my untrained eye the application is not being recognised as an application and I cannot work out how to get it to do that.
    My plugin is still showing as out of date.
    Is there anything you could suggest. Thanks for your time.

  • Apple loop listed twice in the loop browser

    Can someone tell me why my apple loops are being listed twice in the loop browser?

    I actually need help here too. Mine are listed twice but it is because they are on my drive in two places
    Library>Application Support>GarageBand>Apple Loops>Apple Loops for GarageBand
    And also here
    Library>Audio>Apple Loops>Apple>Apple Loops for GarageBand
    Can I toss one of these or does GarageBand and Logic need to see these in different places?

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

  • Photos remain in wrong iPhoto list even after being moved?

    +Mike G.+
    +Posts: 297+
    +Registered: 15-Nov-2004+
    + Photos remain in wrong iPhoto list even after being moved?+
    +Posted: 29-Jan-2009 16:56 +
    Hi,
    +Has anyone else had this problem? Any workarounds?+
    +I have a number of pictures that just show up in the wrong place in Places' list view, but I cannot seem to move them. For example, a photo will show up as being in state X in city Y when it was actually taken at a "Place" in state A, city B. So I click on the photo, hit command-i, type in the name of a place in A/B, and hit done. (Pressing command-i again shows the new name and a pin in the correct place.) However, the photo still shows up when I select state X and city Y from the places browser. This persists even after restarting iPhoto.+
    +Any ideas?+
    +iMac (Mid-2007) Mac OS X (10.5.6)+
    +Mike G.+
    +Posts: 297+
    +Registered: 15-Nov-2004+
    + Re: Photos remain in wrong iPhoto list even after being moved?+
    +Posted: 16-Sep-2009 16:30 in response to: Mike G. +
    +Does not seem to be an issue with the latest version of iPhoto.+
    Im not sure why this has been closed as it is an issue for me as well,
    eg, Trafalgar Square photos appear in the London Eye pushpin, but when checking the photos individually they are correct.
    I am fully up to date with my software and this issue only appears to have raised itself on the latest version of iphoto (8.1 (415))
    Removing the locations and re-adding them does not fix the issue you just end up with the same result or a different mixture of incorrect pictures in the push pins.
    Message was edited by: Carn

    The best way to get assistance on the forum is to provide a clear and detailed description of the problem and report any steps you've already taken to solve the issue and anything that resulted therefrom.
    Im not sure why this has been closed as it is an issue for me as well,
    It's been closed because the User who had this issue found a solution. Only the person who creates the thread can close it. This person had no idea you even existed, let alone that you might have a similar issue. I'm sure if he had he'd have left it open, just waiting for you to come along.
    Is not a resolving answer to the issue and appears to be a very narrow minded approach to resolving issues!
    Let's see. Someone has an issue. They create a thread on the forum. They find a solution. They mark the thread as answered. This is narrow minded?
    Regards
    TD

  • Why is a 'globe' contact available in Global Address List (which belongs to AD), but I cannot find it on AD server?

    I have a topic at link:
    http://social.msdn.microsoft.com/Forums/en-US/7b74fd63-1d0d-449e-9f31-83b707683053/finding-microsoft-document-about-globe-contact-in-outlook-address-book?forum=outlookdev&prof=required
    Please see the post first.
    I dot not make sense about why a 'globe' contact is available in Global Address List (which belongs to AD), but I cannot find it on AD server? I think the cause relates to Exchange server.
    Could you give me an explaination!
    Thanks advance.

    And here the Documentation:
    http://technet.microsoft.com/en-us/library/bb201680.aspx
    Mail contacts
    Mail contacts typically contain information about people or organizations that exist outside your Exchange organization. Mail contacts can appear in your organization’s shared address book (also called the global address list or GAL) and other address lists,
    and can be added as members to distribution groups. Each contact has an external email address, and all email messages that are sent to a contact are automatically forwarded to that address. Contacts are ideal for representing people external to your Exchange
    organization (in the shared address book) who don't need access to any internal resources. The following are mail contact types:
    Mail contacts   These are mail-enabled Active Directory contacts that contain information about people or organizations that exist outside your Exchange organization.
    Mail forest contacts   These represent recipient objects from another forest. These contacts are typically created by directory synchronization. Mail forest contacts are read-only recipient objects that can be updated or
    removed only by means of synchronization. You can't use Exchange management interfaces to modify or remove a mail forest contact.
    Georg

  • Long list of directories being indexed

    when I click set up n my browser I have a long list of "directories being indexed". I have indexed everything from my external drive. How can I get rid of the extra "directories being indexed" in the set up window? I erased all apple loop index files I could find but they are still showing in the set up in soundtrack pro

    deleting the apple index files and clicking the minus in the set up window removed them

  • Find all Z programs which are being modified in last month

    hii all,
    I want to find all Z programs which are being modified in last months.Is this possible??.is there any standard or z-program which can give me the detail of all Z-program which are modified.
    It is possible if i get last month Request but suppose if there are more than 100 request per month then it is not possible to go through each individual Request and find Z-programs.
      Waiting for ur reply.
    <removed_by_moderator> ... read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]!
    Thaking You.
    Edited by: Julius Bussche on Jul 17, 2008 7:16 PM

    Hello
    REPORT ZCHPROG.
    TABLES: D010SINF.
    DATA: PROGTXT(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA: PROGTXT1(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA:
       BEGIN OF MT OCCURS 0,
    PROG LIKE D010SINF-PROG,
    EDTX LIKE D010SINF-EDTX,
    R3STATE LIKE D010SINF-R3STATE,
    UNAM LIKE D010SINF-UNAM,
    CNAM LIKE D010SINF-CNAM,
    UDAT LIKE D010SINF-UDAT,
    UTIME LIKE D010SINF-UTIME,
    END OF MT,
    N(4),
    PROG(20) TYPE C,
    MIN(10) TYPE C.
    RANGES: UDAT1 FOR D010SINF-UDAT.
    RANGES: UTIME1 FOR D010SINF-UTIME.
    SELECT-OPTIONS: PROG1 FOR D010SINF-PROG,      "
                    UNAM1 FOR D010SINF-UNAM,      "
                    CNAM1 FOR D010SINF-CNAM.      "
    PARAMETERS DEN(4) TYPE C DEFAULT '1'.
    PARAMETERS SEC(5) TYPE C DEFAULT '30'.
    PARAMETERS DOP AS CHECKBOX DEFAULT ' '.
    START-OF-SELECTION.
    IF DOP NE SPACE.
    MIN = SEC * 60.
          UTIME1-SIGN = 'I'.
          UTIME1-OPTION = 'BT'.
          UTIME1-LOW = SY-UZEIT - MIN.
          UTIME1-HIGH = SY-UZEIT.
       APPEND UTIME1.
    ENDIF.
          UDAT1-SIGN = 'I'.
          UDAT1-OPTION = 'BT'.
          UDAT1-LOW = SY-DATUM - DEN.
          UDAT1-HIGH = SY-DATUM.
       APPEND UDAT1.
    SELECT PROG UNAM UDAT UTIME R3STATE EDTX CNAM
    INTO (MT-PROG, MT-UNAM, MT-UDAT, MT-UTIME, MT-R3STATE, MT-EDTX,MT-CNAM )
             FROM D010SINF  WHERE PROG IN PROG1
                                         AND UDAT IN UDAT1
                                         AND UTIME IN UTIME1
                                         AND CNAM IN CNAM1
                                         AND UNAM IN UNAM1.
    APPEND MT.
    ENDSELECT.
    N = 1.
    WRITE: / 'from', UDAT1-LOW, 'to', UDAT1-HIGH.
    SORT MT BY UNAM UDAT UTIME.
    LOOP AT MT.
    WRITE: / MT-CNAM,MT-PROG,MT-UNAM,MT-UDAT, MT-UTIME,
    MT-R3STATE, MT-EDTX.
    N = N + 1.
    ENDLOOP.
    WRITE: / N.

  • Random account added to my list of accounts

    Hey, when I logged on this morning, I noticed an account that wasn't mine.
    ([e-mail removed for privacy and security]) was added to my list of accounts I'm managing.  I don't know why this is here and I was wondering if any of you did.  If you guys can help, that would be good.  Its not much of a problem, more like an annoyance to have it there. 
    It wont let me post a screenshot of it, since apparently "gyazo is not permitted in this community" 
    Thanks for the help -[Removed for privacy]

    Hey Casper,
    There's some sort of conflict with a content holder you have placed within the page.  When you remove it the url restores back to normal. 
    I would look into this script in the "add this" content holder which most likely is affecting the output of the url.
    Kind regards,
    -Sidney

  • Extra computers added to authorisation list after upgrade (iTunes 9)

    I've just upgraded iTunes to version 9 on 2 of my computers (1 pc laptop & 1 imac). On both these machines when I have went to turn Home Sharing on I get a message saying that the computer is not authorised so I go to "Store" then "Authorise computer" and insert my password. Each time I have done this it has added both the computers to my authorisation list which now has 4 computers registered instead of the 2.
    Is there a way of removing computers from this list so that I only have the 2 as it should be?
    Thanks
    Bryan

    Thanks for the link Jim.
    I de authorised then re authorised the mac and it's only showing up as having one account so i'll do the same for the laptop and see how that goes.
    Bryan

  • When does d4s get added to the list of camera that can tether on Lightroom

    when does d4s get added to the list of camera that can tether on Lightroom 5?

    Well, I got very tired of waiting for Adobe to support my Nikons so I use a Camranger, their computer and tablet app and tether wirelessly to LR. Yes, there is a bit of a delay amounting to a few seconds but in practice my customers love it and have not complained. I use the few seconds to better connect with them, answer questions, etc. Being wireless gives me more range of movement and I have one less cord. The Camranger goes in an old phone holster that clips to my shirt or pants pocket, connected by a 3 ft cord.
    You need to enable auto import in LR and point it to the folder that Camranger saves the files to. Since it is an import you can use presets if you wish. I've not seen a downside yet and Camranger has support for new cameras very quick like. An added plus is having full wireless functionality for your camera via the Camranger apps. You can change any setting, focus, use live view, etc.. using a phone, tablet or laptop.

  • Video and songs downloaded not added to my list

    Could someone get back to me reguarding some purchases that went through but the songs and videos were not added to my list. A couple of songs were in the process of being downloaded but we had a power outage, can you help me.

    Look under the Store menu in iTunes for the "Check for purchases" command and run that. You may find the other items there to be downloaded.
    If not, follow the instructions on their web page for contacting the iTunes Store. They'll probably then reset the download for those missing tracks.

  • How can i get Background Jobs list which is made me?

    I created background job using JOB_OPEN and SUBMIT and JOB_CLOSE.
    I need to Background Job list which is made me..
    Do u know any function or logic?
    plz~

    [BP_JOBVARIANT_OVERVIEW|http://help.sap.com/saphelp_45b/helpdata/en/fa/096ccb543b11d1898e0000e8322d00/frameset.htm]
    BP_JOBLOG_READ

Maybe you are looking for

  • Running a Java Multi Thread Program in database

    I have created a multi threaded program in Java and it runs successfully from the command prompt. I want to create a DBMS Job which will wake up at regular intervals and runs the java program(Java stored procedure). Is this possible in 9.2/10G ?? If

  • Generation of custom code from oracle DB.

    Hi All, I am new to oracle BIP which is used to pull reports.I got a requirement to pull the data through BIP using java custom code.I got the API doc for BIP and statrd developing some sample code.My input to the code will be in XML which has one un

  • Outlook Anywhere is not working

    Hello all, I have Exchange 2007 SP3 running.  I have enabled Outllook anywhere.  I have yet to be able to get it to work.  I have been told the only port I need open is 443.  when I go to setup my clients, I do a manual configuration.  for the server

  • Nokia 700 massive battery drain after fp1

    Why nokia? I mean why? With gps or not the battery drain is huge if i play 2 hours of asphalt every day i cannot reach the night! Apart of that, better than any android, smooth experience nice new features ! but battery

  • Can we delete old access_log in apache

    the access log of apache can be deleted or not? As the logs exists were 3months old(access_log_pls.1135987200.gz,access_log.1135900800.gz)......... whether it wont affect the instance and apache......... Edited by: suryabalaj on Mar 31, 2009 9:18 AM