package com.wizzardo.tools.collections.flow.flows;

/**
 * Created by wizzardo on 16.04.16.
 */
public class FlowMax<A> extends FlowProcessOnEnd<A, A> {
    private A max;

    public FlowMax(A def) {
        max = def;
    }

    @Override
    public void process(A a) {
        if (max == null || ((Comparable<A>) max).compareTo(a) < 0)
            max = a;
    }

    @Override
    public A get() {
        return max;
    }
}

@@ -149,27 +149,8 @@
 A%3E %7B
-%0A    private A max;
 %0A%0A  
@@ -183,19 +183,22 @@
         
-max
+result
  = def;%0A
@@ -261,19 +261,22 @@
     if (
-max
+result
  == null
@@ -296,19 +296,22 @@
 ble%3CA%3E) 
-max
+result
 ).compar
@@ -338,77 +338,18 @@
     
-max = a;%0A    %7D%0A%0A    @Override%0A    public A get() %7B%0A        return max
+result = a
 ;%0A  

update 'max'