code: public void toSelf(def<T> func) {
                  $(array).forEach((e, i) -> {
                          array[$(i)] = func.apply(e);
                  });
          }
docs: change elements in the array
  
  @param func function returns an element to replace current element