I have an unexpected situation in a project in which all types extending one class are packed into a Java collection; but only a specific extension of that class contains an additional method. Let's call it "also()"; and let me be clear that no other extension has it. Right before performing one task on every item in that collection, I need to call also() on every item that implements it. The easiest way forward is this: It works fine, but I'm not comfortable with the "instanceof" in there.
Michael Eric Oberlin
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with Michael Eric
Contact Michael Eric, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack