size() == 0 -> isEmpty()
There exists an inspection to convert the statement
collection.size() == 0
to
collection.isEmpty()
but unfortunately, I can't find the opposite to change
!collection.isEmpty()
to
collection.size() > 0
Am I missing something?
Tom
Please sign in to leave a comment.
Hello Tom,
You can use Structural Search for this kind of transformation. I'm not sure
it would be useful to have in a product (as for me, I don't find the second
variant to be more readable than the first one).
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
That's what I've done so far. BTW, I remember that there were structural
replace intentions in the past, but I can't find them any more. Are they gone?
Please leave this option to the user. There exists a couple of bidirectional
changes with the inspections which make IDEA very configurable to the
personal taste.
Tom
Dmitry Jemerov wrote:
>> There exists an inspection to convert the statement
>>
>> collection.size() == 0
>>
>> to
>>
>> collection.isEmpty()
>>
>> but unfortunately, I can't find the opposite to change
>>
>> !collection.isEmpty()
>>
>> to
>>
>> collection.size() > 0
>>
>> Am I missing something?
>>
>> Tom
>>
Hello Tom,
>> You can use Structural Search for this kind of transformation.
>>
No, they're still there. Settings | Inspections | General | Structural Search
Inspection.
>> I don't find the second variant to be more readable than the first
>> one
>>
JIRA issue is welcome as usual.
>> Hello Tom,
>>
>> You can use Structural Search for this kind of transformation. I'm
>> not sure it would be useful to have in a product (as for me, I don't
>> find the second variant to be more readable than the first one).
>>
>>> There exists an inspection to convert the statement
>>>
>>> collection.size() == 0
>>>
>>> to
>>>
>>> collection.isEmpty()
>>>
>>> but unfortunately, I can't find the opposite to change
>>>
>>> !collection.isEmpty()
>>>
>>> to
>>>
>>> collection.size() > 0
>>>
>>> Am I missing something?
>>>
>>> Tom
>>>
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Thanks. I hope, I remember it. ;)
IDEA-24166
Tom
Dmitry Jemerov wrote:
>>> You can use Structural Search for this kind of transformation.
>>>
>> That's what I've done so far. BTW, I remember that there were
>> structural replace intentions in the past, but I can't find them any
>> more. Are they gone?
>>
>>> I don't find the second variant to be more readable than the first
>>> one
>>>
>> Please leave this option to the user. There exists a couple of
>> bidirectional changes with the inspections which make IDEA very
>> configurable to the personal taste.
>>
>> Tom
>>
>> Dmitry Jemerov wrote:
>>
>>> Hello Tom,
>>>
>>> You can use Structural Search for this kind of transformation. I'm
>>> not sure it would be useful to have in a product (as for me, I don't
>>> find the second variant to be more readable than the first one).
>>>
>>>> There exists an inspection to convert the statement
>>>>
>>>> collection.size() == 0
>>>>
>>>> to
>>>>
>>>> collection.isEmpty()
>>>>
>>>> but unfortunately, I can't find the opposite to change
>>>>
>>>> !collection.isEmpty()
>>>>
>>>> to
>>>>
>>>> collection.size() > 0
>>>>
>>>> Am I missing something?
>>>>
>>>> Tom
>>>>