Suppose, I have made a class named Worker.
public class Worker implements Serializable{
String username, password;
}
And say, in the main function/any other method that works with this class, I created few instances.
Worker first = new Worker("Arty", "Sif"); //Worker(String name, String pass)
Worker second = new Worker("Sirius", "Pass");
And then I stored them in a file, for example "store.bin" using objectoutputstream. My question is, if I want a particular instance during runtime, Sirius for example, is there any OTHER way to get it than just reading through the entire file loading each object and comparing them with a unique field of the instance? As doing so will take a lot of time. Thanks in advance.