Unreachable code(Iterator)

Discussion in 'Plugin Development' started by Cryices, Jul 2, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Cryices

    Do you know why this isn't working?
    Code:
     Iterator<String> localIterator;
        for (Iterator<Entry<Something, Integer>> i =  Util.getSomething(event.getItem()).entrySet().iterator(); i.hasNext(); localIterator.hasNext())  {
          Map.Entry<Something, Integer> entry = (Map.Entry<Something, Integer>)i.next();
     
          localIterator = ((Something)entry.getKey()).getConflicts().iterator();
    continue;
    String c = (String)localIterator.next();
    
    f.y.i. getConflicts returns a List<String> and getSomething(item) returns a Map<Something, Integer>
    The error is on "String c = (String)localIterator.next();" it says the code is unreachable. What could be the problem? Do I have to change my iterator type(<String>) and if so what would I change it to? Thanks for reading this btw :) Also if you wish for further understanding, Something is an enum, ( not that important )

    Edit: It's most likely the "continue", how can I fix it?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  2. Offline

    RawCode

    try fixing code indent\format first
     
Thread Status:
Not open for further replies.

Share This Page