Hakea is correct.
You might also try adding a special field to the type which will help identify the type. Then only work on the types that match the identity. If, however, you are trying to gain speed by NOT looping through them all, then you could try Hakea's ideas.
You might also try adding a special field to the type which will help identify the type. Then only work on the types that match the identity. If, however, you are trying to gain speed by NOT looping through them all, then you could try Hakea's ideas.