class ClassInstanceUtils {

  public static Collection getInstancesOf(Collection typed, TopicIF type) {
    Collection result = new ArrayList();
    
    // Loop over the typed objects to see if they're instances of the type
    Iterator iter = typed.iterator();
    while (iter.hasNext()) {
      Object object = iter.next();
      if (object instanceof TypedIF) {
        if (isInstanceOf((TypedIF)object, type)) result.add(object);
      } else {
        if (isInstanceOf((TopicIF)object, type)) result.add(object);
      }
    }
    return result;
  }

}