which of these would you prefer: ``` when (target...
# codereview
t
which of these would you prefer:
Copy code
when (targetHandler) {
    is HandlerCollection -> targetHandler.apply { addHandler(defaultHandlers) }
    is HandlerWrapper -> targetHandler.apply { handler = defaultHandlers}
}
and
Copy code
(targetHandler as? HandlerCollection)?.apply { addHandler(defaultHandlers) }
(targetHandler as? HandlerWrapper)?.apply { handler = defaultHandlers }
1️⃣ 19
s
For my own knowledge, on the
when
block do you actually need to use apply in this case? or could you just call
targetHandler.addHandler(defaultHandlers)
and
targetHandler.handler = defaultHandlers
t
thanks, will fix that