Utility method - Pass a File or String? [closed]
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Here's an example of a utility method: public static Long getFileSize(String fileString) { File file = new File(fileString); if (file == null || !file.isFile()) return null; return file.length(); } Is it a good practise to pass a String rather than a File to a method like this? In general what reasoning should be applied when making utility methods of this style? This is my preferred