I have this lines of code:
List<Long> list = new ArrayList<>();
if (n < 0) throw new RuntimeException();
if (n == 0) return list;
I want to use Ternary condition
:
return (n < 0) ? (throw new RuntimeException()) : list;
But i have compile time exception.