forked from functionaljava/functionaljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path$.java
More file actions
38 lines (29 loc) · 776 Bytes
/
$.java
File metadata and controls
38 lines (29 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package fj.data;
import fj.P1;
/**
* The constant arrow, for attaching a new name to an existing type. For every pair of types A and B, this type
* is the identity morphism from B to B.
*/
@SuppressWarnings({"UnusedDeclaration"})
public final class $<A, B> extends P1<B> {
private final B b;
private $(final B b) {
this.b = b;
}
/**
* @deprecated JDK 8 warns '_' may not be supported after SE 8. Replaced by {@link #constant} and synonym {@link #__} (prefer constant).
*/
@Deprecated
public static <A, B> $<A, B> _(final B b) {
return constant(b);
}
public static <A, B> $<A, B> __(final B b) {
return constant(b);
}
public static <A, B> $<A, B> constant(final B b) {
return new $<A, B>(b);
}
public B _1() {
return b;
}
}