IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
DelegateFunction.cs
Go to the documentation of this file.
1using System;
2
3namespace java.util.function
4{
5
11 public class DelegateFunction<TArg, TResult> : Function
12 {
13
14 readonly Func<TArg, TResult> _func;
15
21 public DelegateFunction(Func<TArg, TResult> func)
22 {
23 this._func = func ?? throw new ArgumentNullException(nameof(func));
24 }
25
26 public Function andThen(Function after)
27 {
28 return Function.__DefaultMethods.andThen(this, after);
29 }
30
31 public Function compose(Function before)
32 {
33 return Function.__DefaultMethods.compose(this, before);
34 }
35
36 public object? apply(object t)
37 {
38 return _func((TArg)t);
39 }
40
41 }
42
48 public class DelegateFunction<TArg1, TArg2, TResult> : BiFunction
49 {
50
51 readonly Func<TArg1, TArg2, TResult> _func;
52
58 public DelegateFunction(Func<TArg1, TArg2, TResult> func)
59 {
60 this._func = func ?? throw new ArgumentNullException(nameof(func));
61 }
62
63 public BiFunction andThen(Function after)
64 {
65 return BiFunction.__DefaultMethods.andThen(this, after);
66 }
67
68 public object? apply(object t1, object t2)
69 {
70 return _func((TArg1)t1, (TArg2)t2);
71 }
72
73 }
74
75}
Implementation of Function that forwards to a Func<T, TResult>.
DelegateFunction(Func< TArg, TResult > func)
Initializes a new instance.
DelegateFunction(Func< TArg1, TArg2, TResult > func)
Initializes a new instance.
object? apply(object t1, object t2)
Function compose(Function before)
BiFunction andThen(Function after)