forked from sermakov/JavaPatternMirea
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsk7.java
More file actions
Latest commit
52 lines (36 loc) · 1.38 KB
/
Copy pathtsk7.java
File metadata and controls
52 lines (36 loc) · 1.38 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
packagesome;
publicclasstsk7 {
@FunctionalInterfaceinterfaceF<T, R> { Ra(Ta); }
static <T> Tprt(Ta, F<T, String> d, Stringb) {
System.out.println("" +
(d != null ? d.a(a) : a) +
(b != null ? b : ""));
returna;
}
////////////////////////////////////////
@SuppressWarnings("StatementWithEmptyBody")
publicstaticvoidmain(String[] args) {
for (vari = 0; i <= _a; i++,
prt(FlWgPrFct.a((int) (Math.random() * 9)).a(), null, null) );
prt(((Any) newPrx(newRl(5), a -> a * 1000)).a(), null, null);
}
////////////////////////////////////////
finalstaticint_a = 9;
interfaceIFlWgPr { inta(); }
staticrecordFlWgPr(inta) implementsIFlWgPr
{ @Overridepublicinta() { returna; } }
staticclassFlWgPrFct {
privatestaticfinalIFlWgPr[] a = newIFlWgPr[_a];
privateFlWgPrFct() {}
staticIFlWgPra(intc) { return
a[c] == null ?
a[c] = prt(newFlWgPr(c), b -> "" + b.a(), " created") :
a[c]; }
}
////////////////////////////////////////
interfaceAny { inta(); }
staticrecordRl(intb) implementsAny
{ @Overridepublicinta() { returnb; } }
staticrecordPrx(Anya_, F<Integer, Integer> c) implementsAny
{ @Overridepublicinta() { returnc.a(a_.a()); } }
}