Iterator < Subscriber > getSubscribers ( Object event ) { ImmutableSet < Class < ? > > eventTypes = flattenHierarchy ( event . getClass ( ) ) ; List < Iterator < Subscriber > > subscriberIterators = Lists . newArrayListWithCapacity ( eventTypes . size ( ) ) ; for ( Class < ? > eventType : eventTypes ) { CopyOnWriteArraySet < Subscriber > eventSubscribers = subscribers . get ( eventType ) ; if ( eventSubscribers != null ) { // eager no-copy snapshot subscriberIterators . add ( eventSubscribers . iterator ( ) ) ; } } return Iterators . concat ( subscriberIterators . iterator ( ) ) ; }
Gets an iterator representing an immutable snapshot of all subscribers to the given event at the time this method is called .