code: public static <T> T single(Collection<T> items, Predicate<T> predicate) {
          T singleOrNull = singleOrNull(items, predicate);
  
          if (singleOrNull == null) {
              throw new InvalidOperationException("No items match!");
          } else {
              return singleOrNull;
          }
      }
docs: Returns the only element from a collection that matches the given predicate.
  Throws a {@link InvalidOperationException} if the number of
  found elements is not exactly 1.
  
  @param items source items
  @param predicate predicate function
  @param <T> type of elements in the source collection
  @return the only element that matches the given predicate
  @throws InvalidOperationException if the number of found elements is not exactly 1