public function distinct($distinct=null)
    {
        $distinct = LambdaUtils::toSelectCallable($distinct);

        $keys = array();
        $collection = $this->newInstance();
        foreach($this as $record)
        {
            $value = call_user_func($distinct, $record);
            $hash = md5(json_encode($value));
            if(!isset($keys[$hash]))
            {
                $keys[$hash]=true;
                $collection->add($record);
            }
        }
        return $collection;
    }
public function distinct($distinct=null)
    {
        $distinct = LambdaUtils::toSelectCallable($distinct);

        $keys = array();
        $collection = $this->newInstance();
        foreach($this as $record)
        {
            $value = call_user_func($distinct, $record);
            $hash = md5(json_encode($value));
            if(!isset($keys[$hash]))
            {
                $keys[$hash]=true;
                $collection->add($record);
            }
        }
        return $collection;
    }
public function distinct ( $ distinct = null ) { $ distinct = LambdaUtils :: toSelectCallable ( $ distinct ) ; $ keys = array ( ) ; $ collection = $ this -> newInstance ( ) ; foreach ( $ this as $ record ) { $ value = call_user_func ( $ distinct , $ record ) ; $ hash = md5 ( json_encode ( $ value ) ) ; if ( ! isset ( $ keys [ $ hash ] ) ) { $ keys [ $ hash ] = true ; $ collection -> add ( $ record ) ; } } return $ collection ; }
filter duplicate field by condition
@param callable|string|null $distinct
@return \PerrysLambda\ArrayBase
filter duplicate field by condition