Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Update 2</strong>:</p> <p>In Eclipse 4.4 <a href="http://help.eclipse.org/luna/topic/org.eclipse.jdt.doc.user/whatsNew/jdt_whatsnew.html?cp=1_6" rel="nofollow noreferrer">What's New in Luna (JDT)</a> a QuickFix was added for this issue. This can be also used for arrays, collections and maps (key sets and values).</p> <p><img src="https://i.stack.imgur.com/ESkox.gif" alt="enter image description here"></p> <p><strong>Update 1</strong></p> <p>I recently found an eclipse plugin that provides postfix code completion (<a href="https://github.com/trylimits/Eclipse-Postfix-Code-Completion" rel="nofollow noreferrer">https://github.com/trylimits/Eclipse-Postfix-Code-Completion</a>). This is how it works for the foreach loop:</p> <p><a href="https://i.stack.imgur.com/OYRpi.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OYRpi.gif" alt="enter image description here"></a></p> <p>Beside, the plugin provides more helpful competitions :)</p> <p>For Eclipse before 4.4:</p> <p>I'm also having the same issue but I wasn't able to find a solution. So, for the moment I perform following steps to get the desired loop.</p> <p>fore[Ctrl-space] and select the foreach template, I get the following:</p> <pre><code>for (iterable_type iterable_element : iterable) { } </code></pre> <p>then I perform a double click on <code>iterable</code> and replace it with the method:</p> <pre><code>for (iterable_type iterable_element : functionWhichReturnsList()) { } </code></pre> <p>on the next step just click on <code>functionWhichReturnsList()</code> and hit Ctrl-1. Eclipse will suggest to change the type <code>iterable_element</code> to <code>TypeOfItemsInList</code>. This is want you get at the end:</p> <pre><code>for (TypeOfItemsInList iterable_element : functionWhichReturnsList()) { } </code></pre> <p>Now, you just need to find a proper name for <code>iterable_element</code>. Just double click on it and start typing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload