public class NotAppliedException extends FastRuntimeException
Used by function object to indicate that it doesn’t apply to the parameter specified. This exception extends FastRuntimeException thus performs much better than normal RuntimeExceptions. Here is one example of using NotAppliedException:
_.F2<Integer, Integer, Integer> divide1 = new _.F1<Integer, Integer, Integer>() {
@Override
public int apply(int n, int d) {
if (d == 0) return NotAppliedException();
return n/d;
}
}
In the above example thrown out NotAppliedException when divider is zero is faster than do the calculation directly and let Java thrown out
| Constructor and Description |
|---|
NotAppliedException() |
doFillInStackTrace, fillInStackTraceaddSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringCopyright © 2014–2021 OSGL (Open Source General Library). All rights reserved.