code: @GwtIncompatible("incompatible method")
    @SuppressWarnings("unchecked")
    @Nullable
    public static <T> T findValueOfType(final Collection<?> collection,
        @Nullable final Class<T> type) {
      if (CollectionUtils.isEmpty(collection)) {
        return null;
      }
      T value = null;
      for (final Object element : collection) {
        if (type == null || type.isInstance(element)) {
          if (value != null) {
            // More than one value found... no clear single value.
            return null;
          }
          value = (T) element;
        }
      }
      return value;
    }
docs: Find a single value of the given type in the given Collection.
  
  @param collection the Collection to search
  @param type the type to look for
  @return a value of the given type found if there is a clear match, or {@code null} if none or
  more than one such value found