Question: Suppose `actorRefList` is an iterable object and it contains 5 elements. The commented line below each element is its class type(not included in the iterable.)

```
Actor[akka.tcp:/ /ServerSystem@127.0.0.1:5555/user/ServerActor#318394851]
//class akka.remote.RemoteActorRef

Actor[akka.tcp:/ /Server2System@127.0.0.1:5556/user/Server2Actor#1747632436]
//class akka.remote.RemoteActorRef

Actor[akka:/ /ClientSystem/user/ClientActor/$a#393644788]
//class akka.actor.LocalActorRef

Actor[akka:/ /ClientSystem/user/ClientActor/$b#1517923571]
//class akka.actor.LocalActorRef

Actor[akka:/ /ClientSystem/user/ClientActor/$c#-1004799764]
//class akka.actor.LocalActorRef

```

I want to loop through this iterable and select the first one that is a `RemoteActorRef` so that I can assign it as the remote actor that my local actor sends messages to. I am thinking of a for loop but I don't exactly know how to identify the first element that is a `RemoteActorRef`. How can I distinguish elements based on their class types? Any help is appreciated. Thanks.

Answer: 
I would stay away from checking class type even if it was possible. If you know the address of the local actor system then you can use that compare against the `ActorRef`s you have in your `Iterable`. If you don't have a known local actor ref handy, you can create a dummy path like so:

```
val localPath = system / "foo"

```

Then, once you have a known local `ActorPath`, you can use that in a `find` call to your `Iterable` like this:

```
val remoteRef = refs.find(_.path.address != localPath.address)

```
You may test object class with `obj.isInstanceOf[Class]` operation.

So, in your case it will be something like:

```
actorRefList.find{ _.isInstanceOf[RemoteActorRef] }

```