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

import com.wizzardo.tools.collections.flow.FlowProcessor;

/**
 * Created by wizzardo on 16.04.16.
 */
public class FlowMin<A> extends FlowProcessor<A, A> {
    private A min;

    public FlowMin(A def) {
        min = def;
    }

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

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

@@ -49,67 +49,8 @@
 s;%0A%0A
-import com.wizzardo.tools.collections.flow.FlowProcessor;%0A%0A
 /**%0A
@@ -136,18 +136,21 @@
 cess
-or
+OnEnd
 %3CA, A%3E %7B
 %0A   
@@ -149,27 +149,8 @@
 A%3E %7B
-%0A    private A min;
 %0A%0A  
@@ -183,19 +183,22 @@
         
-min
+result
  = def;%0A
@@ -261,19 +261,22 @@
     if (
-min
+result
  == null
@@ -296,19 +296,22 @@
 ble%3CA%3E) 
-min
+result
 ).compar
@@ -338,77 +338,18 @@
     
-min = a;%0A    %7D%0A%0A    @Override%0A    public A get() %7B%0A        return min
+result = a
 ;%0A  

update 'min'