Is there a way to do automatic implicit type conversion in Java? For example, let's say I have two types: "FooSet" and "BarSet", which are set views. It is easy to convert between types, so I wrote two utility methods:
public FooSet barTOfoo(BarSet input) { }
public BarSet fooTObar(FooSet input) { }
Now tell me there is a method that I want to call:
public void doSomething(FooSet data) {
}
But all I have is BarSet myBarSet... it means adding text, for example:
doSomething(barTOfoo(myBarSet));
Is there a way to tell the compiler that certain types can be automatically passed to other types? I know this is possible in C ++ with overload, but I cannot find a way in Java. I want to simply indicate:
doSomething(myBarSet);
And the compiler knows to automatically call barTOfoo()