[SOLVED] Is it bad programming style to just typecast an object?
I have multiple sections of code where I take the selected object(using a selectionListener) from my tree and just work with a type casted version of that. for example
server = (Server)selObj;
works the exact same way as iterating through a loop doing selObj.getName().equalsIgnoreCase(servers[x]) where servers is an array created using ServerGroup.getChildren().
I'm assuming the typecast does the same as my loop, just behind the scenes, since I can comment out the compare loop and have everything work exactly as it should.
Is there some reason I shouldn't do this over the loop?