As I understand it, you have this way:
public void someMethod(Collection c)
and you need to pass one element to it (e.g. MyObject).
There are two options here:
Create a list, add MyObject to it, and then pass the List to method.
Use polymorphism if possible! - Create a new method with the MyObject parameter as:
public void someMethod (MyObject obj);
source share