/** * This method publishes the message to any subscribed listerners. * * @access public * @static * @param IHashMap\Type $xs the left operand * @param ITuple\Type $message a tuple containing the event key and * value to be published * @return IHashMap\Type the map */ public static function publish(IHashMap\Type $xs, ITuple\Type $message) : IHashMap\Type { $k = $message->first(); if ($xs->hasKey($k)) { ILinkedList\Module::each($xs->item($k), function (callable $y) use($message) { $y($message->second()); }); } return $xs; }
/** * This method returns whether the specified key exists. * * @access public * @static * @param IHashMap\Type $xs the hash map * @param Core\Type $k the key to be found * @return IBool\Type whether the key exists */ public static function hasKey(IHashMap\Type $xs, Core\Type $k) : IBool\Type { return $xs->hasKey($k); }