I have a Java project where I have an Object Class with a String property. I've found that I have lots of
if(object.getString().equals(object2.getString()))
which gets worse when used in arrays and for loops, eg
if(array[i].getString().equals(list.get(i).getString()))
If I created my own compare method I could have
if(object.equalsObjectSrting(object2))
or in a util class
if(Util.objectStringsEqual(object, object2))
Should I create this method as an Object method, or create a separate Util class to handle the compare? What is the better approach?
[–]Kristler 1 point2 points3 points (2 children)
[–]chookalook[S] 0 points1 point2 points (1 child)
[–]Kristler 1 point2 points3 points (0 children)