4 ms·
It's not only about the length of the method. Ternary operators may look simple enough, but they could lead to some subtle errors. For example, try to guess wha
by Igor_Wiwi 2y ago
It's not only about the length of the method. Ternary operators may look simple enough, but they could lead to some subtle errors. For example, try to guess what's wrong with this code:
List<String> trimAndAdd(List<String> input, String newItem) {
List<String> result = new ArrayList<>(input.size() + newItem == null ? 0 : 1);
...