I'm attempting to make a class that will convert ArrayLists of objects into ArrayLists of other objects. i.e.
ArrayList<Foo> convert(ArrayList<Bar> input){
//conversion logic
}
ArrayList<Bar> convert(ArrayList<Foo> input){
//conversion logic
}
Unfortunately Java doesn't want to have two functions with the same name and what it believes to be the same inputs and outputs.
I'm attempting to go a different route. Instead of multiple functions with the same name, I want to make one function that accepts an ArrayList, determines which type of object is inside, does the proper conversion, and returns an ArrayList:
ArrayList convert(ArrayList input){
//conversion logic for Foo
//conversion logic for Bar
}
Is something like this possible?