Refactoring few core classes to return generic collections + iterate through these collections using enhanced for-loop

I believe this makes the code much clearer, noticably shorter and easier to refactor in the future. Also I found one oversight bug (check PanelInstance  in the WorkspaceImpl commit) when inner for loop was caling hasNext() on the outer for loop's iterator.