public static boolean containsInstance(Collection<?> collection, Object element) {
      if (collection != null) {
         for (Object candidate : collection) {
            if (candidate == element) {
               return true;
            }
         }
      }
      return false;
   }