api/src/main/java/com/tersesystems/echopraxia/api/Value.java
/**
   * Turns a list of T into a list of fields using the transform function.
   *
   * @param transform the transform function
   * @param values the list of fields.
   * @param <T> the type of the element
   * @return the Value.
   */
Turns a list of T into a list of fields using the transform function.
@param transform the transform function
@param values the list of fields.
@param  the type of the element
@return the Value.
Turns a list of T into a list of fields using the transform function . @param transform the transform function @param values the list of fields . @param the type of the element @return the Value .
@NotNull
  public static <T> ObjectValue object(
      @NotNull Function<T, Field> transform, @NotNull List<T> values) {
    if (values == null || values.size() == 0) {
      return ObjectValue.EMPTY;
    }
    List<Field> fields = new ArrayList<>(values.size());
    for (T value : values) {
      Field field = transform.apply(value);
      if (field != null) {
        fields.add(field);
      }
    }
    return new ObjectValue(fields);
  }
@ NotNull public static < T > ObjectValue object ( @ NotNull Function < T , Field > transform , @ NotNull List < T > values ) { if ( values == null || values . size ( ) == 0 ) { return ObjectValue . EMPTY ; } List < Field > fields = new ArrayList < > ( values . size ( ) ) ; for ( T value : values ) { Field field = transform . apply ( value ) ; if ( field != null ) { fields . add ( field ) ; } } return new ObjectValue ( fields ) ; }
Turns a list of T into a list of fields using the transform function.
Turns a list of T into a list of fields using the transform function .