You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Isn't it a better way to ask the listener if it may accept the Object by calling a Listener#doesAccept(Object):bool or Listener#doesAccept(Class):bool? (I don't care the actual name, but I prefer the class variant).
The text was updated successfully, but these errors were encountered:
No, such a method would have to do the logic to see if it can accept the object, return a boolean, then received would be called and that same logic would need to be done again. A listener does not need to use a list of instanceof checks, it can use a HashSet or any other technique it wants. If you have a large number of types, you could use a wrapper with an int or enum, eg:
Isn't it a better way to ask the
listener
if it may accept the Object by calling aListener#doesAccept(Object):bool
orListener#doesAccept(Class):bool
? (I don't care the actual name, but I prefer theclass
variant).The text was updated successfully, but these errors were encountered: