[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [eclipse-pmc] Review of mass changes
- From: Eric Williams <ericwill@xxxxxxxxxx>
- Date: Wed, 19 Jun 2019 13:21:51 -0400
- Delivered-to: email@example.com
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0
On 6/19/19 12:47 PM, Mickael Istria wrote:
My 2c below ;)
About !longChain.isEmpty() vs longChain.size() > 0, I favor the first
one because isEmpty() is theorically a O(1) operation while size() is a
O(n). Of course, most of smart enough implementations have this
optimized and make size() a O(1), but there is usually no guarantee it
is so. So size() is more expensive that isEmpty() and should be preferred.
About readability, I understand the concern and I would like to suggest
an alternative for that case: longChain.isEmpty() == false, which seems
to have the qualities requested by all parties.
+1, this is a nice compromise!
Software Engineer - Eclipse/SWT Team