Paul Clapham wrote:You're making the assumption that Outlook starts by loading the entire .PST file into memory, for a start. At least that was the context of your original question. And yes, Outlook would be completely unusable if it did that. So I believe it doesn't do that.
Gerard Gauthier wrote:I ask you to consider an ASCII text editor which opens an ASCII text file. Now you modify the contents of that file in the ASCII text editor. How do you update the persistent memory(we'll say hard drive) that contains the original? Can you put forth a scheme that'll work without creating a new file?
What is fileDelimiter?
That technique of creating objects is error-prone
I see you are up to date with try-with-resources
Remember how important the documentation comments are.
That means you would consider making it a static method.
What is Inventory? What does it do?
What is Product.ID? It sounds like the way a database might distinguish between Products, but isn't strictly necessary for a Java Product class.
There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors. -- Leon Bambrick
Liutauras Vilda wrote:Menu.value(userInput).menuOption();
Liutauras Vilda wrote:In general, I find your code hard to read. First and main reason is poor formatting (blocks of code crammed to one line).
Liutauras Vilda wrote:Another question: why index is String? At least in my head, when I think about index, I have in my mind a number, probably a whole number.
Liutauras Vilda wrote:I also would have an enum in a separate source file instead of having it in a Test class (even if that's just for test). Otherwise makes it harder to follow the code as really Test class and Menu enum aren't related in any sense.
Junilu Lacar wrote:Using reflection to achieve what you said is technically possible but in my opinion, that's not the real problem.
Junilu Lacar wrote:If you really want to get rid of the long switch statement, which for a simple program that has a limited lifetime isn't that bad, then I would try something like what I show below. This to me is a more obvious design:
salvin francis wrote:routingTable can be a map with key as Integer
Dave Tolls wrote:You don't need that second loop, as you already have code in the enum that returns a Menu based on the given index.
You are essentially duplicating code at the moment.
Campbell Ritchie wrote:Do you really mean class methods? Remember that class methods are the opposite of instance methods.