vertx/src/main/java/eu/internetofus/common/vertx/ModelResources.java
/**
   * Return the function that can be used to search a value by its identifier.
   *
   * @param idComparator predicate to check if the specified model has the
   *                     specified id.
   *
   * @return the index of the element on the list or {@code -1} if not found.
   *
   * @param <E> type of the elements.
   * @param <I> type of the identifier.
   */
Return the function that can be used to search a value by its identifier.
@param idComparator predicate to check if the specified model has the
specified id.

@return the index of the element on the list or  -1 if not found.

@param  type of the elements.
@param  type of the identifier.
Return the function that can be used to search a value by its identifier . @param idComparator predicate to check if the specified model has the specified id . @return the index of the element on the list or - 1 if not found . @param type of the elements . @param type of the identifier .
static public <E, I> BiFunction<List<E>, I, Integer> searchElementById(final BiPredicate<E, I> idComparator) {
    return (models, id) -> {
      if (models != null) {
        final var max = models.size();
        for (var i = 0; i < max; i++) {
          final var model = models.get(i);
          if (idComparator.test(model, id)) {
            return i;
          }
        }
      }
      return -1;
    };
  }
static public < E , I > BiFunction < List < E > , I , Integer > searchElementById ( final BiPredicate < E , I > idComparator ) { return ( models , id ) -> { if ( models != null ) { final var max = models . size ( ) ; for ( var i = 0 ; i < max ; i ++ ) { final var model = models . get ( i ) ; if ( idComparator . test ( model , id ) ) { return i ; } } } return - 1 ; } ; }
Return the function that can be used to search a value by its identifier.
Return the function that can be used to search a value by its identifier .