Change a collection while you're iterating...

I read from somewhere that changing a Collection while you're iterating with an Iterator would risk a ConcurrentModificationException, but the source didn't include an example code to show this so I don't fully understand it. Could anyone give an example code when this would happen? Thanks

Don't use this code! This is an example how you'll get a ConcurrentModificationException.
List<String> l = new ArrayList<String>();
l.add("foo");
l.add("bar");
l.add("foobar");
for (String s : l) {
  System.out.println(s);
  l.remove("bar");
}

Similar Messages

  • Change store while you have credit

    How do I change apple store while I still have credit left? I don't care about the credit, I just want to change the store! I moved from USA to Norway, and I now want to use my norwegian credit card. How do I do this?

    You can't until you get rid of the credit.
    Go here:
    https://expresslane.apple.com/Issues.action
    Ask for assistance.

  • How can we change delivery document while doing shipment

    Hi all,
    How can we change delivery document in background while changing shipment document.My requirement is to change the netweight in delivery while doing shipment.Actually it gets blocked when we open the shipment.
    Thank You,
    Regards,

    Hi,
    if you have done the PGI(Post Goods Issue), you can't change the delivery.
    If you want to change the devlivery Qty, you should create the delivery with Partial Split (= X) and you can deliver the splitted qty with a new delivery.
    Regards,
    Baburaj

  • How can i change the font while im coding?

    How can i change the font while im coding? I am not talking about the final product and inserting fonts in my documet i am talking about when i am in the progress of coding I want to change the font so it is way more pleaseing to the eye when I am staring at it while coding? please do help and thanks!

    Editing the source is a bit of a pain because you'll have to redo it after every update.  It's better to write yourself a mini-extension that adds a new stylesheet -- that is also very simple to do.  Just follow these instructions: https://github.com/adobe/brackets/wiki/Customize-Your-Code-Font.
    - Peter

  • Change the permission while placing the file

    Hi Experts,
    I have a production issue :
    I am placing the .txt file into a SFTP server location from a SFTP Location[NO Transformation in the file]. (Sender and receiver channels are SFTP)
    I am using user- user1(for example) which have the read write access to the particular folder, hence when it places the file it places with 664 permission .(This permission gives only user1 as read/write access , but other user have read only access).
    The requirement :
    The user2 want to deletes the file from the particular folder location , they want to know by any means can PI change the permission while placing the file into that location so that user2 can also have read/write access.
    Can you provide the opinion whether it can be done using SFTP receiver channel or any other option to change the permission of the file.

    As far as i know the permissions are related to the folder and the User not for files
    While creating the access, a particular user authorizations related particular folder, not related to files.
    So this should be done some thing like by giving the read/write access to user2 as well
    Regards

  • Re-config of ssh fails after changing Oracle Home while installing RAC

    Hi,
    Red Hat Linux 5
    Oracle 10.2.0.1 RAC installation
    While installing Oracle RAC under ORACLE user we are Configuring ssh for the first time works fine. If any changes done (Eg: i changed the home path of oracle user), then the ssh configuration will prompt for password no matter how many times you reconfigure the ssh.
    I have created another OS user orclusr instead of oracle to over come this issue
    Have any one came across this situation or finds a solution, please reply back.
    Regards
    hari
    Edited by: hariharan.thyagarajan on Apr 8, 2010 12:33 PM

    hariharan.thyagarajan wrote:
    Hi,
    One of the most important reasons for building Real Application Clusters is stability.
    Changing the Oracle Home, after the cluster is built is about 180 degrees counter to this philosophy.
    I agree with this but we face the error while installing oracle cluster
    here is my scenario:
    create oracle user on both the nodes(rac1,rac2):
    1) my first oracle home - /home/oraclePart of thinking these things through before proceeding is to recognize that the concept of ORACLE_HOME is not the same as the $HOME directory for the OS user who happens to be named "oracle".
    Since you appear to be still in the process of building this system, I'd suggest you go back to square one while you can.
    2) configure ssh on both the nodes
    3) due to sapce constraint in /home mount point we changed the oracle home to /oracle
    4) so my new oracle home is /oracle
    5) re-configuring of ssh is working fine, no error's
    6) but if i issue the below command ssg date rac2 it prompts for password why ?
    Any possibility to over come this issue ?
    Regards
    hari
    Edited by: hariharan.thyagarajan on Apr 8, 2010 1:14 PM

  • People Picker in Central Administration on change Site Collection Administrator page.

    Hi there
    We are coming to the end of our rope here.
    We have a problem where the people picker is not working in Central Administration, particularly the change Site Collection administrator page. It simply does nothing but hang the page, it doesn't even give the red squigglies. The search dialogue boxes also
    hangs. It works in other parts of Central Administration.
    The environment has 2 domains with one way trust between them and the peoplepicker-searchadforest attribute is set.
    Any suggestions?

    Hi Chad,
    Did this issue only happen to the "_admin/owners.aspx" page for your Central Administration site?
    Please compare the peoplepicker-searchadforest attribute for your Central Administration web applicaiton with other working web application, see if they are the same ( iisreset may need for your Central Administration ).
    Also check
    ULS log for more related error message (also try others may like "developer dashboard","fiddler", ect.) recoreded when this issue occurs.
    Thanks
    Daniel Yang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to Change Exchange Rate while Preparing Goods Receipt

    Hai all,
    Help in find any user exits or BADI for changing Exchange rate while preparing Goods Receipt for Import Schedule Agreement. Or help me for re-directing system to take exchange rate from different effective date. we will be provided by us.
    Thanks & Regards
    Nagarajan M

    You need to assign KOMK-KURST = 'E', for those two condition types. If it had been item number specific, you could have used USEREXIT_PRICING_PREPARE_TKOMK(RV60AFZZ).
    Do one thing, put a breakpoint on FM 'PRICING' and then do selective runtime analysis.
    Check whether any user exit/BADI/ explicit enhancement are available when condition types are processed in a loop. If nothing is available, try implicit enhancement.
    Link to refer for selective runtime analysis - Runtime Analysis for VOFM
    Also try with VOFM requirements ( not sure whether changing KOMK-KURST is permissable in requirement as normally  we only set sy-subrc values to suppress/allow condition types ). Don't forget to assign requirements against condition types in pricing procedure.

  • Change purchasing group while making service entry

    Dear all
    can we change purchasing group while making service entry
    with Regards

    System will not allow you to change the Purchasing group while creating service entry sheet.You will get error User XXXX already processing Purchase order XXXXXXXXX

  • How changes the collection of a saved book in Lightroom?

    I started to created a book in lighroom and did not use a collection. When I saved* the book Lighroom put the used photo in the book in a collection. But I want to see
    all the photos and not just the used photos. But i can not change the collection! (when i changed the collection a new book is visible and my saved book will disappear )..
    How can i set the option that not only the used photos are visible in the collection?
    *(Lighroom ask me when i saved the book to only show the used photo, and i said yes, but now i want to changes that, so i can see all my photos to add more new photos)
    I like to hear from you..
    Thanks

    I want to use an existing smart collection for creating my book. This is a book that I'm editing and making new additions. The smart collection continues to grow as I set keywords on pictures. Unfortunately, since I saved the book now there is no way to use my smart collection. I had to manually add files to it.
    Arrrrg, I want my book to use the existing smart collection. Only when I publish should it limit it to a photoset.

  • Service order IW32 - change header data while saving with UE

    Hello
    I have the following problem. I need to clear while saving
    order in IW31/2 one single fields this is CAUFVD-ABGSL
    but I cannot find any user exist that could allow me to CHANGE this field I tryied to use :
    IWO10009 IH-Auftrag: Kundenprüfung zum Zeitpunkt 'Sichern'
    but it has only CAUFVD as importing parameter *"  IMPORTING
    *"     VALUE(CAUFVD_IMP) LIKE  CAUFVD STRUCTURE  CAUFVD
    while I need to change one field while saving order
    Did somebody dealt with this problem
    I will be really gratefull for help
    Best regards
    Bogumila

    Hi,
    I've had a request for one of my customers to automatically change this field as well.
    Apparently, it was possible to change the CAUFVD structure, but it wasn't updating the database table AUFK.
    First of all, I wrote a new function module to update it straight in the AUFK database table, using the order ID and the provided RA key. This because using FM BAPI_ALM_ORDER_MAINTAIN threw an error.
    FUNCTION Z_0PM_CHANGE_RA_KEY.
    *"*"Update Function Module:
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(IV_AUFNR) TYPE  AUFNR
    *"     VALUE(IV_RA_KEY) TYPE  ABGR_SCHL
         UPDATE aufk SET abgsl = iv_ra_key WHERE aufnr = iv_aufnr.
    ENDFUNCTION.
    Then in user exit PPCO0001 - FM EXIT_SAPLCOBT_001 I'm calling this in an update task, to avoid any current object locks while saving. It's working both in transactions IW31 and IW32:
    SELECT SINGLE absl FROM z0pmrakey
            INTO lv_ra_key
            WHERE auart = lv_auart_rep
              AND ilart = lv_ilart_rep
              AND eqtyp = lv_eqtyp_rep.
          CALL FUNCTION 'Z_0PM_CHANGE_RA_KEY' IN UPDATE TASK
            EXPORTING
              iv_aufnr       = lv_aufnr
              iv_ra_key      = lv_ra_key.
    In case you have any questions, please ask.
    Kind regards,
    Joris

  • Why does it say in the Firefox Safe Mode article that all of the changes are temporary while in Safe Mode, then later it says "Note: The following changes cannot be undone."?

    Why does it say in the Firefox Safe Mode article that all of the changes are temporary while in Safe Mode, then later it says "Note: The following changes cannot be undone."?

    When you open Firefox in Safe Mode, it automatically disables your custom settings, themes, and add-ons. THOSE changes are temporary.
    However, if you click any of the boxes underneath the line, "You can make some or all of these changes permanent", and then choose "Make Changes and Restart", everything you checked will be forever changed, even when you start Firefox again in 'normal' mode. [See attached image for a preview of the Safe Mode options].
    To be clear:
    1. If you check any of the boxes but do NOT select "Make changes and restart", those things will not be changed at all in safe mode.
    2. If you select any of the boxes and you DO select "Make changes and restart", you will permanently lose any of the items you checked (bookmarks (except for backups), user preferences, etc.).
    If you performed the action in step 2 above, you will only be able to restore those things if you have a previously created back-up of your Mozilla Profiles folder (not the same as the Firefox program folder).
    Hope this helps.

  • How can i change my region while i still have only $0.63

    how can i change my region while i still have $0.63 pls advise.

    If you can't spend it then you can try contacting iTunes Support and ask if they can remove the balance so that you can change country : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • In our program, we are concerned about reducing CPU work; how to wait until a boolean condition changes in a "while loop"?

    Is there a way to wait until a boolean condition changes (instruction is sent) in a "while loop" (because I want the program run until I press exit button)? Now it is consuming a lot of CPU because it is running the loop very fast waiting for instructions unless I stop the program.
    Thank you.

    Use /functions/time and dialog/wait until next millisecond multiple in the
    loop. Input 100ms.
    "mcdesm" wrote in message
    news:[email protected]..
    > In our program, we are concerned about reducing CPU work; how to wait
    > until a boolean condition changes in a "while loop"?
    >
    > Is there a way to wait until a boolean condition changes (instruction
    > is sent) in a "while loop" (because I want the program run until I
    > press exit button)? Now it is consuming a lot of CPU because it is
    > running the loop very fast waiting for instructions unless I stop the
    > program.
    >
    > Thank you.

  • Black screen upon wake from sleep when I change power state while in sleep

    Hi,
    I'm having this problem where my MacbookPro won't always wake from sleep.
    OSX is 10.6.3 and fully updated.
    I've done a lot of troubleshooting, and I can now replicate the issue 100%:
    1 - Put the MacbookPro to sleep by closing lid
    2 - Change power source (from plugged-in to battery or vice versa)
    3 - open lid - MacbookPro will wake, but stays at black screen and is unresponsive.
    Only if I change power state while sleeping will this issue show. Anyone else experincing this issue, and anygot got a clue on what to do?
    regards,
    Lasse

    I've seen the same issue after upgrading to 10.6.3. I have a one year old MacBook Pro. I would have the screen be black after coming back from sleep or hibernate (tried both).
    The workaround I found is to close the lid -almost- all the way and then immediately open it back up again, like I am catching the Mac going back to sleep and then changing my mind. For whatever reason, this has been reliably solving my issue for the last couple weeks reliably.
    Only other oddity I noticed is that immediately after upgrading OS X told me that my one year old battery needed to go in for servicing...
    Anyway, now all looks right with the world assuming you don't mind a quick close/open cycle.. Lovely...
    Tim

Maybe you are looking for

  • Need help moving music collection from external hard drive to Macbook Pro

         I just bought a Macbook Pro today after my Windows desktop was bricked a few weeks ago. Luckily, I didn't lose the most important files on my pc, my music, because it was all on my Zune, as well. So, I borrowed an external hard drive, copied all

  • How do I split a single event with many clips into multiples events, one event per date?

    I archived the video from my AVCHD camera into a Final Cut video archive. Later I imported this into iMovie. All the clips from this archive (spanning several months) are dumped into a single event. If I recall, older versions of iMovie would import

  • Services menu says NO SERVICES APPLY

    Hi, How do you change the preferences for Safari to turn on the services menu? I have checked all the preferences in the services preferences, and I still get the greyed out menu saying NO SERVICES APPLY. Where are all the services? C

  • Installing Business Content blog

    Can u plz tell me how to install Business Content with screen shots. If someone know BI Blog then please give me. my id is : [email protected] amit shetye

  • Customer end-user material price

    Dear SD Experts, I have the following scenario: - Material ABC is sold to customer 123 - Customer 123 has end-user X,Y and Z - Material ABC price for customer end-user X is £5.00 - Material ABC price for customer end-user Y is £7.00 - Material ABC pr