I have `SingletonA` and `SingletonB`, classes in an obfuscated jarfile. They do not implement the same interface nor are they children of the same superclass, but they do have similar characteristics, which the original programmers missed.

I want to be able to pass them as arguments to a method like this:

```
public void method(SingletonObject singleton) {
    //do stuff with singleton
}

```

However, the only thing I can think of that would work is this:

```
    public void method(Object singleton) {     
        if(singleton instanceof SingletonA) {
           SingletonA singletonA = (SingletonA) singleton;
            // do stuff with singletonA
        }
        else if(singleton instanceof SingletonB) {
            SingletonB singletonB = (SingletonB) singleton;
           //do exact same stuff with singletonB
        }
        else {
            return;
        }
    }

```

Since the bottom example is terrible, what can I do to make it look more like the top.