The following Utility class calls within itself the same static methods, but has no shared global variables. But it looks like the method nameTo() is "shared" and an issue. Am I right with it, and that it's unsafe?
public class Utility
{
public static MyObject create_1(boolean b)
{
MyObject o = new MyObject();
o.setName(nameTo(b));
return o;
}
public static MyObject create_2(boolean b)
{
MyObject o = new MyObject();
o.setName(nameTo(b));
return o;
}
public static String nameTo(boolean b)
{
if(b)
return "NameA";
else
return "NameB";
}
}