jeudi 8 juin 2017

Java - FOR Loop Won't Finish

I have a method that contains a FOR loop that keeps stopping well before it is supposed to. Once it reaches index 2 (out of over 15,800) in the array, it stops; it doesn't even move on to the statements after the FOR loop in the method. At index 2, it displays the dialog window, but does not go to the IF statement. What could be causing this? See the code below:

public List<String> getSavedViewElements (TSModel model)
{       
    List<TSModelElement> items = model.getModelElements();      

    Object[] el = items.toArray();                      

    List<String> savedViews = new ArrayList<String>();

    for (int i = 0; i < el.length; i++)
    {                   
        if (((TSModelElement) el[i]).getTypeName().equals("SavedView") && (Boolean)((TSAttributedObject) el[i]).getAttributeValue("Show") == true)
        {
            savedViews.add("View: " + (String) ((TSAttributedObject) el[i]).getAttributeValue("ViewName"));             
        }
    }   

    return savedViews;
}

Aucun commentaire:

Enregistrer un commentaire