flatMap method.

@method flatMap

@param callable $func

@return array $flattened
486543
public function flatMap(callable $func) : array
    {
        $list = $this->list;
        $acc = [];

        foreach ($list as $val) {
            $acc[] = $func($val);
        }

        return $acc;
    }
349027
public function mapWithKeys(callable $callback)
    {
        $result = [];

        foreach ($this->items as $key => $value) {
            $assoc = $callback($value, $key);

            foreach ($assoc as $mapKey => $mapValue) {
                $result[$mapKey] = $mapValue;
            }
        }

        return new static($result);
    }
920533
public static function call($key, callable $func)
    {
        $trace = debug_backtrace();
        if ($function = $trace[1]["function"]) {
            $key = $function . "_" . $key;
            if ($class = $trace[1]["class"]) {
                $key = str_replace("\\", "_", $class) . "_" . $key;
            }
        }

        if (static::check($key)) {
            return static::get($key);
        }

        $return = $func();

        static::set($key, $return);

        return $return;
    }
1154797
public function map(callable $f) {
        return !$this->isEmpty() ? Option::just($f($this->get())) : Option::none();
    }
707937
public function fold(callable $func, $acc) : self
    {
        $list = $this->list;

        foreach ($list as $val) {
            $acc = $func($acc, $val);
        }

        return new static($acc);
    }
557919
public function reduce(callable $func, $initial = null)
    {
        $answer = new HaystackReduce($this->toArray());
        return $answer->reduce($func, $initial);
    }
95295
protected function _createData(callable $func): array
    {
        $data = \call_user_func($func);
        if(!\is_array($data) && !$data instanceof \Traversable) {
            return []; //ignore invalid results
        }
        $return = [];
        foreach($data as $key => $value) {
            $return[$key] = [
                'value' => $value,
                'expires' => null
            ];
        }
        return $return;
    }
115063
public function map(Closure $func)
    {
        $clone = clone $this;

        $clone->data = array_map($func, $this->data);
        $clone->updateBody();

        return $clone;
    }
740900
public function mapWithIndex(callable $function)
    {
        $values = array_values($this->data);

        return new Seq(array_map($function, array_keys($values), $values));
    }
570306
public function filter(callable $function): Dict
    {
        $result = new Dict();

        foreach ($this->data as $key => $value) {
            if (!!$function($key, $value)) {
                $result->offsetSet($key, $value);
            }
        }

        return $result;
    }
1008808
public function map(callable $function)
    {
        $output = new Dict();

        foreach ($this->data as $key => $value) {
            $output->offsetSet($key, $function($key, $value));
        }

        return $output;
    }
335596
public function filter($func)
    {
        $index = 0;
        $nodes = [];
        foreach ($this->_nodes as $node) {
            $selector = new Selector($this->_document, $node);
            if ($func($selector, $index++) !== false) {
                $nodes[] = $node;
            }
        }

        return new SelectorList($this, $nodes);
    }
119004
function baseMapArgs (fun, mapFun) {
    return _.arity(fun.length, function () {
      return fun.apply(this, __map.call(arguments, mapFun));
    });
  }
299010
static function iterate($func)
	{
		$db = \App::get('db');

		$query = "SELECT cn FROM `#__xgroups`;";

		$db->setQuery($query);

		$result = $db->loadColumn();

		if ($result === false)
		{
			return false;
		}

		foreach ($result as $row)
		{
			call_user_func($func, $row);
		}

		return true;
	}
739631
public static function array_map_recursive($function, array $array)
    {
        $tmp = array();

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $tmp[$key] = self::array_map_recursive($function, $value);
            } else {
                $tmp[$key] = call_user_func($function, $value);
            }
        }

        return $tmp;
    }
1149476
function mapExpr(array, func) {
  var ret = [];
  for (var i = 0; i < array.length; ++i) {
    ret.push(func(array[i]));
  }
  return ret;
}
1336283
function getMapList($length = -1, $offset = 0, $multicall = false)
    {
        if (!is_int($length)) {
            throw new InvalidArgumentException('length = ' . print_r($length, true));
        }
        if (!is_int($offset)) {
            throw new InvalidArgumentException('offset = ' . print_r($offset, true));
        }

        if ($multicall) {
            return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('Map', true));
        }
        return Structures\Map::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
    }