public Collection < TrafficCounter > channelTrafficCounters ( ) { return new AbstractCollection < TrafficCounter > ( ) { @ Override public Iterator < TrafficCounter > iterator ( ) { return new Iterator < TrafficCounter > ( ) { final Iterator < PerChannel > iter = channelQueues . values ( ) . iterator ( ) ; @ Override public boolean hasNext ( ) { return iter . hasNext ( ) ; } @ Override public TrafficCounter next ( ) { return iter . next ( ) . channelTrafficCounter ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; } @ Override public int size ( ) { return channelQueues . size ( ) ; } } ; }
To allow for instance doAccounting to use the TrafficCounter per channel .