It's not a question of which is faster, rather one of correctness.
An exception is for circumstances which are exactly that, exceptional.
If it is possible for n
to be null
as part of normal business logic, then use an if..else
, else throw
an exception.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…