IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
DelegateConsumer.cs
Go to the documentation of this file.
1using System;
2
3namespace java.util.function
4{
5
6
11 public class DelegateConsumer<T> : Consumer
12 {
13
14 readonly Action<T> _action;
15
21 public DelegateConsumer(Action<T> action)
22 {
23 _action = action ?? throw new ArgumentNullException(nameof(action));
24 }
25
26 public void accept(object t)
27 {
28 _action((T)t);
29 }
30
31 public Consumer andThen(Consumer other)
32 {
33 return Consumer.__DefaultMethods.andThen(this, other);
34 }
35
36 }
37
38}
Implementation of Consumer that sends output to a delegate.
DelegateConsumer(Action< T > action)
Initializes a new instance.