-
general advice needed
Problem: Get a single method to "return" 2 things
Say i have a a method does 2 things - reads a file and (while we're at it) figures out if file containt duplicate keys.
It then returns a properties that represents the file that just was read. Since a method can not return 2 things (right?).
I was thinking of taking that Properties object and storing it as part of an ArrayList . Then i would take all duplicates i already found, storethem in another Properties object and add them to the same Array List.
After all this, i would return a single Array List containing actual non duplicates file content and duplicates.
I hope that this makes sence.
Can you suggest a better approach or what i described is Ok?
Ultimately - I would like to avoid redundancy and use a single method to accomplish 2 tasks
-
I'd create a new class called FileCheckResult that encapsulates all the things determined by your method and return an object of that class.