I need a boolean to be stored with a String (or possibly a Path, not sure which one I want to use yet). I thought about using a Map, so I did some looking around and found out that LinkedHashMaps are the only type of Map that stay in Order when you do something with them.

I could use two arrays, but I'm sure theres something better to use.

Usually I would just make a helper class that stores the String, or Path, and the boolean and make Objects of this class. I know I could do this, but what's the point if the class I need already exists?

Thanks

What's the requirement for keeping them ordered?

Iterating through them.

Does each iteration trigger a reorder? I don't want to iterate over the same ones multiple times.

Iterating any Collection will visit each member once. Do you specifically need to iterate them in the order in which they were created?

Now that I really think about it, No I do not believe so.

I'll explain what I want to Accomplish.

I recently enabled BitLocker on my Desktop PC and I am having issues with Start Up programs not starting (because they are on another drive which isn't unlocked with the system drive). I am going to create an application which will be stored on the system drive which will be run at start up. The application will be configured with paths to files which need to be run at start up and will automatically attempt to open the files. If they were not successfully opened, they will be attempted to be opened again after a set amount of time.

I plan to store the Strings with a boolean which tracks whether the file has been opened.

Why not just take a copy of the list at startup and remove each program from the copy when its started? When the copy is empty you are done, and the original list is still there for next time. (Presumably the original list is a disk file, and the copy is the loaded list in the Java program)

Yeah, that's what I was going to do. I'm just not sure the best class to use.

It doesn't matter! You just need to process and remove entries until there are none left. Any Collection will do. With, I dunno, maybe a dozen entries there is no issue about space or runtime efficiency. Pick one at random.. how about about ArrayList?

Just out of curriocity ... what is the startup method used by the ones that don't start by default? You could also just delay them to start after 30 secs or a minute(I've got conky on my unix system to start 20 secs after user log in for example) when the drive is unlocked, cant you?

BTW in my case, I have a bash script that is executed upon start and the first line in it is a delay

Awesome James, thanks as always.

Slavi, The thing is about just simply delaying it is that if I don't unlock the drive before that time, then it won't try again. This way, every 5 seconds I can retry starting the program if it didn't start.

Yeah correct, it has to be done before the time .. Well I guess you could try the way you and James were going for though, just out of curiosity why having start up programs in differnet drives?

SSD and Storage Drives. My important Programs like my Anti-Virus are put on my SSD whereas the lesser important ones are just put on my Storage Drive.

If you consider an antivirus program an important one(I don't xD), I would highly advice you to get a tool called PeStudio. It has a direct link to virustotal, therefore if you can perform a quick static analysis of any file that you might have suspiciouns on(if you don't know what virtustotal is, it is where you can test a file against 56 different AV vendors simultaniously whether some of them has the file in there databases as malicious, I think it is all checksum based detection)

If checking PE files, pestudio shows quite some additional information suhc as information about the headers of the file and more ..

I would say that, it is a good practice to check any file before opening/running it through there

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.