Converts a {@link Func0} to a {@link FuncN} to allow heterogeneous handling of functions with different arities.

@param f the {@code Func0} to convert
@return a {@link FuncN} representation of {@code f}
542420
public static <R> FuncN<R> fromFunc(final Func0<? extends R> f) {
        return new FuncN<R>() {

            @Override
            public R call(Object... args) {
                if (args.length != 0) {
                    throw new RuntimeException("Func0 expecting 0 arguments.");
                }
                return f.call();
            }

        };
    }
62340
public static DefaultValueFunction defaultValue(Function function, Object defaultValue) {

		Assert.notNull(function, "Function must not be 'null' for default value operation.");
		Assert.notNull(defaultValue, "DefaultValue must not be 'null'.");

		return new DefaultValueFunction(function, defaultValue);
	}
947136
public static <F, T> List<T> transform(Collection<F> fromList,
            Function<? super F, ? extends T> function) {
        if (CollectionUtil.isEmpty(fromList)) {
            return Collections.emptyList();
        }

        List<T> ret = new ArrayList<T>(fromList.size());
        for (F f : fromList) {
            T t = function.apply(f);
            if (t == null) {
                continue;
            }
            ret.add(t);
        }

        return ret;
    }
1003662
def SpiceUDFUNS(f):
    

    @functools.wraps(f)
    def wrapping_udfuns(x, value):
        result = f(x)
        value[0] = c_double(result)

    return UDFUNS(wrapping_udfuns)
1031335
public <A> Optional<A> transform(final ThrowableFunction<Payload, A, IOException> f) {
        if (hasPayload()) {
            return payload.flatMap(p -> lift(p, f));
        }
        return Optional.empty();
    }
201282
public <R, F extends ThirdFunction<R, Integer, Integer, List<Sort>>> R get(F thirdFunction) {
        if (StringUtils.isBlank(sort)) {
            return thirdFunction.apply(PageUtils.page(page), PageUtils.size(size), Lists.newArrayList());
        }
        List<Sort> sorts = Arrays.stream(sort.split(",")).map(s -> {
            try {
                String[] split = s.split("-");
                if (split.length == 1) {
                    return new Sort(this.apply(split[0]), DESC);
                }
                String direction = split[1];
                direction = !DESC.equalsIgnoreCase(direction) && !ASC.equalsIgnoreCase(direction) ? DESC : direction;
                return new Sort(this.apply(split[0]), direction);
            } catch (Exception e) {
                log.error(e.getMessage(), e);
                return null;
            }
        }).collect(Collectors.toList());
        return thirdFunction.apply(PageUtils.page(page), PageUtils.size(size), sorts);
    }
1355150
public static <T1, T2> Counter<T2> transform(Counter<T1> c, Function<T1, T2> f) {
    Counter<T2> c2 = new ClassicCounter<T2>();
    for (T1 key : c.keySet()) {
      c2.setCount(f.apply(key), c.getCount(key));
    }
    return c2;
  }
424114
public static <T> T[] map(Class<T> c, Function<Long, T> f) {
    @SuppressWarnings("unchecked")
    T[] values = (T[]) Array.newInstance(c, BUCKET_VALUES.length);
    for (int i = 0; i < BUCKET_VALUES.length; ++i) {
      values[i] = f.apply(BUCKET_VALUES[i]);
    }
    return values;
  }
1240504
public static <T> BiFunction<String, Map<String, String>, T>
            mkSimpleConverter(Function<String, T> convert) {
        return (name, data) -> convert.apply(data.get(name));
    }
1359572
public static <T, F> Function<F, T> bind(final Function<F, T> function) {
        return new Function<F, T>() {
            @Override
            public T apply(F arg) {
                return function.apply(arg);
            }
        };
    }
181671
public static <T, U> Collector<T, ?, Integer> bitOrInt(ToIntFunction<? super T> function) {
        return Collector.of(() -> new int[1],
            (s, v) -> {
                s[0] = s[0] | function.applyAsInt(v);
            },
            (s1, s2) -> {
                s1[0] = s1[0] | s2[0];
                return s1;
            },
            s -> s[0]
        );
    }
458507
public static FuncN<Void> fromAction(final Action0 f) {
        return new FuncN<Void>() {

            @Override
            public Void call(Object... args) {
                if (args.length != 0) {
                    throw new RuntimeException("Action0 expecting 0 arguments.");
                }
                f.call();
                return null;
            }

        };
    }
121424
public static <T1,T2,T3> Function<T1,T3> comp(final Function<T2,T3> func1, final Function<T1,T2> func2) {
	return new Function<T1,T3>() {
	    public T3 f(T1 x) {
		return func1.f(func2.f(x));
	    }
	};
    }
542615
def copy_func(f, name=None, sinceversion=None, doc=None):
    
    # See
    # http://stackoverflow.com/questions/6527633/how-can-i-make-a-deepcopy-of-a-function-in-python
    fn = types.FunctionType(f.__code__, f.__globals__, name or f.__name__, f.__defaults__,
                            f.__closure__)
    # in case f was given attrs (note this dict is a shallow copy):
    fn.__dict__.update(f.__dict__)
    if doc is not None:
        fn.__doc__ = doc
    if sinceversion is not None:
        fn = since(sinceversion)(fn)
    return fn
614018
public FaceletTaglibFunctionType<WebFacelettaglibraryDescriptor> getOrCreateFunction()
   {
      List<Node> nodeList = model.get("function");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FaceletTaglibFunctionTypeImpl<WebFacelettaglibraryDescriptor>(this, "function", model, nodeList.get(0));
      }
      return createFunction();
   }
66629
@SuppressWarnings("unchecked")
    public static <T> Function<T, T> compose(final Function<T, T> ... func) {
        return new Function<T, T>() {
            public T apply(final T arg) {
                T result = arg;
                for (int index = func.length - 1; index >= 0; index -= 1) {
                    result = func[index].apply(result);
                }
                return result;
            }
        };
    }
177941
@Deprecated
    static <T, R> Function<T, R> indexedd(final IndexedFunction<T, R> func) {
        return Functions.indexed(func);
    }