Search code examples
javacollectionsred5

How to iterate through a Collection<Set<IConnection>>


I have something like this:

something need here  = scope.getConnections();

//getConnections() returns Collection<Set<IConnection>>

I need to iterate through all connections (the stuff that the getConnections() returns)

How to do that ?


Solution

  • for (Set<IConnection> set : scope.getConnections()) {
       for (IConnection iConnection : set) {
          // use each iConnection
       }
    }