Structural Search/Replace Help Follow
I want to replace my for loops that use iterators with the new easier to read for each loops using the structural search and replace mechanism. I want the following:
iterator = stringlist.iterator(); iterator.hasNext()) { String str = iterator.next(); Blah, Blah, Blah...: }]]>
to become:
I can find the for loop with the following:
$variable$ = $container$.iterator(); $variable$.hasNext();) { $Statements$; }]]>
but I can't find the following statement to assign the variable. I thought that the following would work but it doesn't, what am I missing?
$variable$ = $container$.iterator(); $variable$.hasNext();) { $Type$ $var2$ = $variable$.next(); $Statements$; }]]>
then the replace would be:
Please sign in to leave a comment.
Michael Tennes wrote:
>I want to replace my for loops that use iterators with the new easier to read for each loops
>
If that's possible - sorry, no answer, I'm on Mac => jdk 1.4 -
, JetBrains should add a
Migrate to jdk 5
section in the default Structural Replace templates.
I'm sure there are other valid candidates for automatized migration.
Alain
Hi,
Your template is correct, this is the bug in SR. I will fix it in
Pallada also.
Michael Tennes wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Is there a way to define a live template for the new for loop or is that broken too?
Never mind, looks like you've already done it (the new iter live template).
Hi,
Done for upcoming 4.5.3 and 3087.
Maxim Mossienko wrote:
>> I want to replace my for loops that use iterators with the new easier
>> to read for each loops using the structural search and replace
>> mechanism. I want the following:
to become:
>>
I can find the for loop with the following:
but I can't find the following statement to assign the
>> variable. I thought that the following would work but it doesn't, what
>> am I missing?
then the replace would be:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"