@@ -33,15 +33,20 @@ public static void main(String[] args) {
33
33
var pairs = List .of (new Pair <>(1 , "hello" ), new Pair <>(2 , " " ), new Pair <>(3 , "world" ));
34
34
System .out .println (show (combineAll (pairs , deriveMonoidPair (intAdditionMonoid (), stringConcatMonoid ())), showPair (showInt (), showString ())));
35
35
36
- var mPairs = List .of (new MPair <>(1 , "hello" , intAdditionMonoid (), stringConcatMonoid ())
36
+ var mPairs = List .of (
37
+ new MPair <>(1 , "hello" , intAdditionMonoid (), stringConcatMonoid ())
37
38
, new MPair <>(2 , " " , intAdditionMonoid (), stringConcatMonoid ())
38
39
, new MPair <>(3 , "world" , intAdditionMonoid (), stringConcatMonoid ()));
39
- combineAll (mPairs ).ifPresent (v -> System .out .println (show (v , showMPair (showInt (), showString ()))));
40
+ combineAll (mPairs )
41
+ .ifPresent (v -> System .out .println (show (v , showMPair (showInt (), showString ()))));
40
42
41
43
var p = new Person ("Saeed" , "zarinfam.s@gmail.com" );
42
44
var json = toJson (p , personWriter ()).as (JsObject .class );
43
45
System .out .println (json .get ().get ("name" ).as (JsString .class ).get ());
44
46
47
+ System .out .println (stringConcatMonoid ().combine ("x" , stringConcatMonoid ().combine ("y" , "z" )));
48
+ System .out .println (stringConcatMonoid ().combine (stringConcatMonoid ().combine ("x" , "y" ), "z" ));
49
+
45
50
}
46
51
47
52
}
0 commit comments