Why the ConcurrentModificationException?
Hello my friends from Java.When you run the following code:
143 // Create the Clique's medium.
144 this.medium.addAll(ownerIdentity.getConnection().getMediaProfileNode().flattenMediaProfile());
145 for(MI i:candidateIdentities){
146 Set<SourceMediaProfile>memberMedium=i.getConnection().getMediaProfileNode().flattenMediaProfile();
147
148 for(SourceMediaProfile ownerMediumMediaProfile:this.medium){
149 if(memberMedium.contains(ownerMediumMediaProfile)){
150 continue;
151 }
152 this.medium.remove(ownerMediumMediaProfile);
153 }
...
165 }
I get the following excetption:java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:810)
at java.util.HashMap$KeyIterator.next(HashMap.java:845)
at cliquespace.core.agentdevice.source.SourceClique.<init>(SourceClique.java:148)
The flattenMediaProfile method has the following code:114 public Set<SourceMediaProfile>flattenMediaProfile() {
115 Set<SourceMediaProfile>mps=new HashSet<SourceMediaProfile>();
116 mps.add(this);
117
118 MPN mpn=null;
119 try{
120 mpn=(MPN)this;
121 Collection<SourceMediaProfile<CS,?extends MediaProfileIdentifier,MPN,C,I,MI,P,OP,CL>>mpc=mpn.getParentMediaProfiles();
122 for(SourceMediaProfile p:mpc){
123 mps.addAll(p.flattenMediaProfile());
124 }
125 }catch(ClassCastException cce){/*Do nothing.*/}
126
127 return mps;
128 }
Now, I can probably create tables to do what I'm trying to do with these collections, but I think that I could do something wrong with the collectibles, and, rather than to remain ignorant, I would like to take this opportunity to discover what it might be.Your considered advice would be welcomed.
Thank you
Owen.
It is simply because you can't delete an item in a collection or list, while in a foreach loop over that.
Instead of
for(SourceMediaProfile ownerMediumMediaProfile:this.medium)
Use an iterator as follows:
Iterator iterator = this.medium.iterator() ;
while (iterator.hasNext()){
SourceMediaProfile ownerMediumMediaProfile = iterator.next() ;
// do the remove as you wish.
}
Tags: Java
Similar Questions
-
IPad 3 no comparable with iOS 10. Then why the App Store keep sending updates?
I understand that the iPAD 3 will not accept iOS 10. Why the APPLE APP STORE continue to try to push updates of my apps?
App store updates are regardless of updates to iOS. Even if you don't update to iOS 10, you will always get updates from app store.
-
Why the iPhone 6plus will not open photos app on mac pro for IOS 10 update.
Why the iPhone 6plus will not open photos app on mac pro for IOS 10 update.
A message appears on the iphone asks you to trust the computer it is attached (mac pro 10.10.5)You type 'Confidence' and nothing happens. the photos on mac app publishes this message.
This Mac not yet have been granted access to the media on 'my iPhone '. To import media to this Mac, press 'Trust' on 'my iPhone '. You must first unlock the device.
This actually solved for me after going to settings, General, reset, reset the location and privacy... and then plug in the unit and pressing the trust... hope that works for others.
-
Why the iphone 4 is unable to update version? Latest version 7.1.2
Why the iphone 4 is unable to update version? Latest version 7.1.2
because the material is too slow
-
Why the Airdrop on my iphone 6s cannot work?
Why the drop on my iphone with ios 9.3.5 6s cannot work?
I tried to connect on the iphone 5 s and the retina of mini ipad 2, but airdrop did not find these devices.
I tride to reset all the network, force to restart my iphone and reset all settings, but still did not work.
You know the 6s iphone wifi is always work well. But the Bluetooth is just can be discovered, but never connected because still unable to connect.
Please help with this problem. Thank you
How to use AirDrop with your iPhone, iPad or iPod touch - Apple Support
Use AirDrop to send the contents of your Mac - Apple Support
-
Why the highlighting of text in a PDF document does not work after you save the file
Why the highlighting of text in a PDF document does not work after you save the file
What application you use to highlight?
-
You just bought a macbook pro retina. Why the resolution of the camera is terrible?
You just bought a macbook pro retina. Why the resolution of the camera is terrible? Is there a solution?
The facetime camera is only 720 p, which is 0.92 megapixel. Same 1080 p is only 2.07mp.
It's really designed only for video calls, if you really want to make HiRes video on the internet.
-
Why the chase bank wants a for a version update of Safari until I open my account?
Why the Chase Bank requires an update of Safari. In order to view my account?
What version of OS X and Safari you have installed? What Mac?
-
Yesterday, I paid $29.99 thinking I was getting Grime Fighter, as I have some dirt, but he tells me that I don't have this feature, why the audit! What are the characteristics of fact fees cover $29.99
Do you mean that Avast program: https://www.avast.com/en-us/grimefighter
We can not probably help you with that here on the Firefox support site, but Avast has a page of support here: https://www.avast.com/en-us/support#grimefighter
-
Why the Personal Hotspot from my mobile phone appears in my list of list wifi networks if it is disabled on my phone?
On my iMac, there is an icon for a list of available to join Wifi networks.
One of these Wifi networks is my iPhone Personal Hotspot.
However when I look at my setup on my iPhone Personal Hotspot is off.
I tried to join the Hotspot to my iMac and put.
This is part of a feature called Hotspot instantly. It allows you to connect to your personal hotspot without your password or activate the hotspot on your phone. Don't worry, this does not allow other people to access your hotspot, only devices using the same identifier Apple will see your hotspot. This feature is not using any extra battery life when you're not connected to it. You can learn more about instant Hotspot here: OS X Yosemite: connect to the Internet using instant Hotspot
-
Why the sent folder contains 2 copies of all messages from MacBookPro?
Why the sent folder contains 2 copies of all messages from MacBookPro?
Whenever I have send a message to my Mac Book Pro there is a duplicate in the sent folder. This does not happen with messages sent from the iPhone 6s or Outlook Web site. This happens only when I send a Hotmail.ca and not Gmail.com
signed,
Irritating confusedHey TaylorP56659,
I understand how to duplicate emails sent may irritate you, no worries however! I can help you to see if we can get this sorted out. So if it happens with your Hotmail account, try to check in Mail preferences, behaviors of the Hotmail account mailbox. It is possible that you have sent items save on the server that will allow the Mail application to have twice. This is because a local copy and the copy on the server downloaded is in the follow-up of the app the steps below to disable the registration of sent items on the server and will not happen. You can also check the Hotmail settings via webmail.
1. launch the Mail application
2 select email preferences from the Mail menu bar
3. click on the tab accounts
4. highlight your Hotmail account
5. click on behaviors of the ball
6. click on "store sent the Server Messages.
7 close the preferences of Mail and send a test message
You can see the other Preferences in the mailbox behaviors
The steps above should stop these form of duplicates to appear in your sent folder in app Mail thank you for using communities of Apple Support
Have a great day.
-
Hello
Why the hell it adds every where now? It was not the case before? and why the hell every time I change the home page to be the default, the min that I restart Firefox, it came again on the same silly page I don't know where the hell it came from?
It was a very pleasant experience to use Firefox, but no more, I still love him his heavy on the machine and stuck a lot lately!
incident reports NEVER managed to send that I don't know why!
Come on guys, you can do better than that!
Hi ajag,.
Sorry, you have problems, but probably some adware or malware.Thank you for including the information system. I'm not familiar with "Vonteera free ads" However, he is apparently adware. Pay attention to the advice, followed by research on the internet I would be, for example, do NOT try the YAC website or tool.
Using the Firefox addons Manager and Panel configuration remove toolbars unwanted obvious or programs. Then fully analyze up to tools date and multiple.
Please follow the tips in the link above immediately and then do full scans as shown below in this post.
I notice that you have a user.js file require separately.
Post back saying that you tried and what the results were.You can try these free programs to search for malicious software that work with your existing anti-virus software:
- Microsoft safety scanner
- MalwareBytes' Anti-Malware
- Anti-Rootkit utility - TDSSKiller
- AdwCleaner (for more information, see this other AdwCleaner download page)
- Hitman Pro
- ESET Online Scanner
Microsoft Security Essentials is a good permanent antivirus for Windows 7/Vista/XP, if you do not already have one. Windows 8 already has integrated antivirus.
More information can be found in the article troubleshooting Firefox problems caused by malware .
-
Why the my list of apps in iTunes is empty?
Why the my list of apps in iTunes is empty?
Maybe all your applications are hidden:
Hide and expose the iTunes Store, App Store or purchases made on iBooks Store - Apple Support
-
Why the green light on my magic keyboard and mouse flashes green when I turn on after replacing batteries (and not connect to the computer; battery tested good tester)?
Simply indicates that the devices are on.
Barry
-
Why the simple task of transferring photos that should be done drag and drop from my phone to computer such a chore... It is a success or a failure... open iphotos sometimes sometimes it doesn't.
< published by host >
Drag and drop is not supported from iPhone to computer.
Sync with iTunes or iCloud > keep your photos safely stored and updated on all your devices - Apple Support
Maybe you are looking for
-
How can I get the return status of the page load indicator?
After updating to Firefox 29.0.1, the little spinner loading status page has disappeared.There is more to the display/bar Tools/Customize screen, so I can't put it in the menu barI was doing. Is there an add-on for this?
-
How to split the screen of my mac book
How to split the screen of my Macbook?
-
Whole singed to hexadecimal string to number converter
HI guys... I want to convert the number to hex string to number converter but when I connect integer, otherwise it does not change the value (as if you write 'EC78' you should get "-5000", but I get the value in the range of 60 thousand ")... Any ide
-
the usurpation of EAPOL-logoff
Hello 802 plaintiffs. 1 x Microsoft do not send an EAPOL logoff because Microsoft has no confidence in the log packets. These packages can not be authenticated and can be easily spoofed. Microsoft indicates that an authenticator of 802. 1 x should no
-
Hi all!I'm new here and I am writing here because there are no resellers that allows in Italy has.I need to upgrade my co-worker Suites, but I do not understand what to buy.For the moment, we have an iMac with suite CS6 and a MacBook pro with another