Really really really really want to modify objects in an iterator call
Hey,
I know you are not really allowed to do this, but I am iterating over some objects and I want to modify them while iterating over them without getting a ConcurrentModificationException.
Collection collection = myHashMap.values();
for (Iterator iter = collection .iterator(); iter.hasNext())
MyObject obj = (MyObject) iter.next();
modifySomethingWithinMyObject(obj);
not only does modifySomethingWithinMyObject(obj) modify the object being passed in but it also may modify other values within the hashmap.
This is really killing me. anyone know how to get around this?
I know you are not really allowed to do this, but I am
iterating over some objects and I want to modify them
while iterating over them without getting a
ConcurrentModificationException.If you're using HashMap in a concurrent situation you should synchronize it. That takes care of the ConcurrentModificationException.
You're not allowed to modify the HashMap structure while iterating through it (other than by using the metods available in the Iterator itself). If you do you may get something like a BadStructureException or so.
You can modify the objects stored in the HashMap as long as you don't modify anything used by the equals or hashCode methods (if you've overridden them), but in a concurrent situation you should synchronize all object methods that modifies the objects content.
Similar Messages
-
I really want my Apple TV, iPad and iPhone to sort them in date taken like in iPhoto on my iMac. How do I do that? Sorting on date modified seems so stupid to me, why would anyone need this? Date taken gives a timeline in your event.
The unix commands you need are:
GetFileInfo
SetFileInfo
and maybe find
for cryptic details use the man command
Macintosh-HD -> Applications -> Utilities -> Terminal
man SetFileInfo
You may use the SetFileInfo command to set the file type & the program which will open the file.
# This little gem will do a get info on all files in a directory.
mac $ ls | xargs -I {} GetFileInfo "{}"
file: "/Users/mac/playdoc/oddadocodd"
type: ""
creator: ""
attributes: avbstclinmedz
created: 05/01/2011 14:53:22
modified: 05/01/2011 14:53:22
file: "/Users/mac/playdoc/one.docx"
type: ""
creator: ""
attributes: avbstclinmedz
created: 05/01/2011 13:57:48
modified: 05/01/2011 13:57:48
file: "/Users/mac/playdoc/oneLineFile"
type: "TEXT"
creator: "!Rch"
attributes: avbstclinmedz
created: 05/07/2011 14:27:17
modified: 05/07/2011 14:27:17
file: "/Users/mac/playdoc/oneLineFile.txt"
type: "TEXT"
creator: "!Rch"
attributes: avbstclinmedz
created: 05/07/2011 14:27:49
modified: 05/07/2011 14:27:49
file: "/Users/mac/playdoc/three.docx"
type: ""
creator: ""
attributes: avbstclinmedz
created: 05/01/2011 13:58:03
modified: 05/01/2011 13:58:03
file: "/Users/mac/playdoc/two.docx"
type: ""
creator: ""
attributes: avbstclinmedz
created: 05/01/2011 13:57:56
modified: 05/01/2011 13:57:56
file: "/Users/mac/playdoc/weirder.doc.docx"
type: ""
creator: ""
attributes: avbstclinmedz
created: 05/01/2011 14:50:03
modified: 05/01/2011 14:50:03
# well, ! is a funnie character so we escape it.
mac $ SetFile -t TEXT -c \!Rch two.docx
mac $ GetFileInfo two.docx
file: "/Users/mac/playdoc/two.docx"
type: "TEXT"
creator: "!Rch"
attributes: avbstclinmedz
created: 05/01/2011 13:57:56
modified: 05/01/2011 13:57:56
mac $
mac $ date
Sat May 7 14:40:56 EDT 2011
mac $ -
Is it possible to disable the "Do you really want to logg off" popup?
Well, the full text isn't more complecated than the subject. Is it possible to disable the "Do you really want to logg off" popup? A customer wants to use popup blockers for some reason and hence this logg off popup is rather inconvenient.
I have searched the forum but only found threads about how to tweak the logg off session time and recomendations that you should use the link "Logg off" instead of just closing the browser.
Best regards
BennyHi Benny!
No. The UME parameters like UME.LOGOFF.... are maintained using the offline config tool of the J2EE Engine. Therefore this is no JSP modification.
The option mentioned by me (modifying the masthead iView) indeed is JSP modification and you should avoid that as long as it is possible. I have several customers having additional requirements concerning the layout and functionality of masthead iView (e.g. customer-specific links, completely different order/layout of the elements of the portal header etc.).
A rule of thumb is:
First try to configure.
If not possible ask SDN and/or SAP.
If you get no sufficient answers start thinking about modifications.
Especially the masthead iView is very critical. If you accidentially "destroy" it noone can logon to the portal anymore. If you do this be sure to have at least one or two running portal sessions when deploying the modified iView and that you have a backup of the original iView by your hands. This gives you the chance to restore the original iView version.
If problem is solved now please close this thread. If not tell us your further doubts.
And now: Good luck!
Regards,
Volker -
I really wanted to update my iPhone software iPhone 4 version 5.1.1 to be version 6.0.1
And there is some reason you can't? See the Apple article below.
http://support.apple.com/kb/HT4972 -
I Downloaded something onto my computer and now when I click onto safari yahoo pops up instead of top sites I know certain changes come along with downloading but if there is a way back to top sites and google as my search engine I need it!! I'm not one for change and I love the whole original display that the macs have to offer when you first get your mac so thats why I really want top sites back also it was great when your in and rush and so much easier!! Please HELP immediately this is urgent!!
Identify and remove adware
http://www.thesafemac.com/arg/
or use Adware Removal Tool.
http://www.thesafemac.com/art/ -
Hi,
I have apple account/password on laptop but can't use the same ID etc on new Ipad. On my account it says ID is only for 1 system. I really want only one ID for both Ipad and laptop.
ThanksIt seems that you have used the AppleIDs to "Purchase" your devices, which marries the two for all time and eternity.
For info - Using your Apple ID for Apple services
For Account security issues - Apple ID: Contacting Apple for help with Apple ID account security
regards
CCC -
How do I watch my iTunes movies, tv shows on my mac without having to download them all to my HD? I really want my Mac to function like my Apple TV since I have just moved and don't have my TV for another few weeks. Since I purchased my three Apple TV. I have had no need to download any of my movies to my Mac. Which has been great. However, I remember that I used to now have to do this... or did I? I am just frustrated because I want to stream all this stuff vice haveing to waiting for it all to download fill up my Mac's HD and then just delete. Someone help please?
Play the movie in iTunes to stream it.
Click the cloud icon to download it. -
Is there a way to turn the wireless capabilities off on an AirPort Express? I have an AirPort Extreme as my main router and use the express to just extend it. I only really want to you use the express for hard ethernet connections. For whatever reason when I have my express extend my wifi at home the download speed from just the express is absolutely terrible, drops to about 1.5 mb compared to when it's on the extremes part of the network the speed goes up to 50-75mb. These terrible download speed really only affects the iPhones as my MacBook Pro usually gets the good speed no matter where it is. I don't believe there is anything wrong with my phone because if I am in the part of the house that uses just the extreme the download speeds on the iphone goes up to 50-75mb. As a note I have an AirPort Extreme on the top floor of my house (second floor) that's where my modem is located. On the first floor that's where one airport express is located. I also have another airport express in the basement that is accessed by my landlord. Any thoughts on how to fix this would be helpful.
Is there a way to turn the wireless capabilities off on an AirPort Express? I have an AirPort Extreme as my main router and use the express to just extend it. I only really want to you use the express for hard ethernet connections.
It appears that your networking goals with the AirPort Express is to use it as a wireless Ethernet bridge instead of using it to extend the wireless range of your AirPort Extreme. The latter requires that the Express Wi-Fi radios be enabled.
If you intended to use the Express as a wireless bridge, you just need to reconfigure it to "Join a wireless" network instead of "Extend a wireless network."
For whatever reason when I have my express extend my wifi at home the download speed from just the express is absolutely terrible, drops to about 1.5 mb compared to when it's on the extremes part of the network the speed goes up to 50-75mb.
In an extended network, the placement of the extending base station is critical as it can only extend the wireless network at the bandwidth at which it receives it.
Please check out the following AirPort User Tip for details on optimal base station placement. -
my ipod 4 is stuck in recovery mode and i dont really want to restore it because i havent really backed it up. what should i do in this situation?
If one of these programs will not kick the iPod out of recovery mode then you will have to restore and thus erase the iPod
For PC
RecBoot: Easy Way to Put iPhone into Recovery Mode
or
http://joshuabailey1997.wordpress.com/2010/09/02/recboot-v1-3/
If necessary:
Download QTMLClient.dll & iTunesMobileDevice.dll for RecBoot
and
RecBoot tip
RecBoot may have problems on 64X windows, then try:
Tenorshare ReiBoot – Enter & Exit iPhone, iPad, iPod Recovery Mode with a Single Click
For MAC or PC
The Firmware Umbrella - TinyUmbrella
In the future, frequently backup your device. -
I have had my imac for nearly 18 months now,
It's okay, is the best I can say about it.
It cost me around £800+
So recently (and foolishly!) I downloaded OS Mavericks when I was actually looking for a freebie word processor programme (I got Bean because it's simple like me.)
Now the point of all this is that Mavericks has new features like a redesigned Safari (But I ain't noticed any difference yet) and Imaps (Huh!) and Ibooks and Imovie or something.
So when you are oldish like me, you really don't want people to keep changing and introducing new stuff (most of which is pointless anyway) all the time; because it takes us old ***** a while to get used to the last "improvement."
So you try and get rid of all these new apps that you don't want and didn't ask for anyway,
and then you find out you can't, because they're an integral part of the new OS.
Brilliant!
Then you find that Mail has to redo itself and this thing no longer works properly etc. and you start wishing you hadn't got up that morning...
So you try and get it all back the way it was..
And you can't.
Because you don't have an external hard drive to use the Time machine back up facility.
So you get in touch with Apple Support and it's now nearly bedtime, but at least you feel like you might be gettin' somewhere.
You talk to the supportguy and suddenly you can't remember what the problem is and what your name is, and you're thinking you might as well order in a pizza seein' as you've drunk the last of the gin..."
Anyway the guy manages to keep his temper and you get some degree of order restored but the machine still seems "jumpy" so someone says to you
"Check out the Activity Monitor! That'll tell you if something's not working right."
So you do, but it doesn't.
Just a bunch of numbers and CPU stuff and User Idiot Input etc.
All you really want is some little box to pop up and say,
"Hey! yyyou've really ssscrewed things upppp-p here, old mmmmman!!. This programme is no longer functioning properly, that thing appears to frozen, and you just wiped half your saved photos of Aunt Jessie's 94th birthday celebration (the one's where she had her eyes open)..
Press here for a full maintenance overview and repair menu.."
By this time you are on the floor, your leg's got cramp and you really really need a pee.
But there ain't no maintenance programme, just an activity monitor app you can't make any sense out of, so you yank the **** power cord out of the socket and go to bed..
So you try andDVD-R media that is single layer has 4.3 GB formatted capacity.
DVD+R DL media has 7.8 GB formatted capacity.
DVD-R double sided has 4.3 GB on each side.
Message was edited by: a brody -
My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help
!!!!!Hey kevyg3,
I was able to find an article that I believe will help you move your iTunes purchases from your iPhone over to your new computer:
iTunes Store: Transferring purchases from your iOS device or iPod to a computer
http://support.apple.com/kb/HT1848
Hope this helps,
David -
so i had my ipod stolen and i backed up everythink on to my itunes before, i cant really afford another one and all i really want is the notes what i saved. is there a way to get to them???
No. If you had configured Find My Phone in icloud.com, then you can lock it or erase it, but you cannot recover data from it.
There probably are third-party utilities that might be able to extract data from the backup file itself. Look for them at MacUpdate. -
i dont know why the battery life of my iphone 4 is so low ! i really want to know how many hours i'll have if it's on standby. And how many hours if i use it normally for music and facebook (sometimes a little bit games) !!!
to enhance your battery life, keep screen display to minimum, set screen lock automatically after 1 min, select internet notifications to off.
-
My iPhone was stolen in Asia and it's now in Germany. How do I get it back? All I have left is a serial number, apple ID and password, plus a police report. What do I do now? I really want my phone back. Can someone help me? Thank you, Bobi
No one here can help you, nor can Apple or any carrier. If you know the location, contact the local police where it is located.
-
I have an old file with an .A4P video from 1999. I don't own any Adobe products (and don't really want to buy any). I just want to be able to convert the file to something that I can actually view. Any help?
I was a kid when I made a documentary for a school project. I've been trying to figure out how to retrieve the file. 4 years ago, I was able to get the files off the Iomega Zip drive (finally), but I now see the file is saved as a .A4P. There is also a file saved as a .PKG as well, but I don't know how to open this with my Windows 8 COmputer..a4p is an Authorware v.4 (Windows) project.
Interesting you have it as a .pkg...usually that's a published-on-a- Mac extension, if I recall.
At any rate, can you put the file up on a Box, Dropbox, FTP, etc...and send me a URL?
I should be able to published it so you can view the project (it would be an .exe).
It can't be converted to anything though - not without manual effort.
Maybe you are looking for
-
I need help with moving my music library. I recently upgraded the OS on my computer from Vista to Windows7. During the process it copied my iTunes library to a folder on this same computer (marked it Windows.old) Once the OS was done, I installed a
-
Process OB files in order and send idocs in order as well
Hi. I've placed some files in a folder. With file adapter i want to pick them in order (by name). As result of each file, i get an IDOC posted in SAP. File1.csv, File2.csv, File3.csv and File4.csv. I set EOIO as quaility of service, added a queue nam
-
Stoping VI inbetween when program seeking data from serial port.
I have an application in which I need to read data from two serial port one after other. One read will read 14 byte and other 08 bytes(Just info). Now in between if user need to stop the VI then how to stop it? Kudos are always welcome if you got sol
-
EAP-TLS PEAP FAIL DURING SSH HANDSHAKE
Hi Pros, I am a newbie in the ACS 4.2 and EAP-TLS implementation, with that being said. I face an issue during a EAP-TLS implementation. My search shows that this kind of error message is already certificate issue;However, I have delet
-
Desperately need help with preview/publish problem in Captivate 5
I'm working with Captivate 5 latest version (incl patch) on a Win 7 computer. I have a project of ~120 'light' slides (boxes, buttons, TEBs only on ~30 of the slides), the slide deck is imported from ppt. In addition I have short audio files (recorde