/** * @see co.vaughnvernon.actormodel.actor.ActorFinder#findActorAgentBy(java.lang.Class, co.vaughnvernon.actormodel.actor.Query) */ @Override public ActorAgent findFirstMatching( Class<? extends Actor> anActorType, Query aQuery) { ActorKeyValueTypeElement typeElement = this.typeElementFor(anActorType); for (Actor actor : typeElement.store().values()) { if (actor.matches(aQuery)) { ActorAgent actorAgent = this.actorAgentFactory() .newActorAgentFor(this, anActorType, actor, typeElement.mailbox()); return actorAgent; } } return null; }