Some ideas:
The usual approach in cases like this (looks like Command pattern to meCommand patternish) is passing additional parameters in the constructor. In your case, that means adding
otherArgumenttoBduring construction.Turning the logic around might open up some options. For instance moving doStuff to AParams:
for (String arg : listOfArgs) { AParams p = AParams.create(arg, otherArgument)); for (A a : listOfA) { p.doStuff(a); // Let AParams to the lifting depending on type of A } }Alternatively you can swallow your pride and check with
instanceofin the loop and setotherArgumentmanually before callingdoStuff.
If the above is not possible, then you have no choice except doing what you're doing (broadening the parameter argument). Don't overanalyze this stuff.