Is there something like the following in Apache Common Lang or Spring Utils or do you write your own Util method for this?
List<String> list = new ArrayList<String>();
list.add("moo");
list.add("foo");
list.add("bar");
String enumeratedList = Util.enumerate(list, ", ");
assert enumeratedList == "moo, foo, bar";
I remember the use of...
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 b...
I generally live by the rule that Global variables / functions are evil and that every piece of code should live in the class to which it pertains.
This is a very easy rule to follow, and I believe that I haven't ever run into an issue with this rule until now.
Today, however, I need to add a function to my assembly rather than to a sp...
I have a function in a utility class
namespace GUI.code
{
public class Utility
{
public string GetFileName(string grpID)
{
string filenameUNC = "\\\\" + "localhost" + "\\AgentShare\\";
string realPath = GetPath(filenameUNC);
return realPath;
}
}
}
now i call this function from anoth...