Avoiding instanceOf when finding index of an interface within a list
I totally agree with Uri and have some further comments:


  the class has no idea what the set will contain, it does however know there maybe a IDescriptor that is meant for video..


I'm sorry, but I have to ask: If you're not sure about exactly what the Set contains, why are you storing it in a set in the first place?

Consider instead something like Map&lt;KEY_TYPE, List&lt;? extends IDescriptor&gt;&gt; descriptors; where KEY_TYPE can be a Class&lt;? extends IDescriptor&gt;, a String, or something else that can tell you what type it is.

When adding items to this map you could use:

List&lt;? extends IDescriptor&gt; list = descriptors.get(descriptor.getClass());
if (list == null) {
    list = new ArrayList&lt;&gt;();
    descriptors.put(descriptor.getClass(), list);
}
list.add(descriptor);


And then all you would need to do is to use descriptors.get(VideoDescriptor.class) (assuming VideoDescriptor is not subclassed, otherwise you could loop through the supertypes as well when adding to the list).



Another thought is that you can use a enum to describe what kind of IDescriptor it is, and the IDescriptor type can have a getDescriptorType method. Then you could check if (fragmentDescriptor.getDescriptorType() == DescriptorType.VIDEO)

As I only see a portion of your code and not the big picture, I can't really tell what would be best for you.