3 ms·
Here's a pretty embarrassing one ;): int index = 0; while (!element.equals(sortedList.get(index)) && sortedList.size() > ++index); return index < sortedL
by HoppedUpMenace 7y ago
Here's a pretty embarrassing one ;):
int index = 0;
while (!element.equals(sortedList.get(index))
&& sortedList.size() > ++index);
return index < sortedList.size() ? index : -1;
- bbody 7y agoThanks for sharing!
- sprflyprgrmrguy 7y agothat's the slowest subroutine I've ever seen
- robodale 7y agoAsking for the sortedList size with every iteration of that loop. haha, ouch! :)