Beispiel #1
0
 /**
  * This method unsubscribes a listener.
  *
  * @access public
  * @static
  * @param IHashMap\Type $xs                                 the left operand
  * @param ITuple\Type $entry                                a tuple containing the key and listener
  * @return IHashMap\Type                                    the map
  */
 public static function unsubscribe(IHashMap\Type $xs, ITuple\Type $entry) : IHashMap\Type
 {
     $k = $entry->first();
     if ($xs->__hasKey($k)) {
         $ys = ILinkedList\Module::delete($xs->item($k), $entry->second());
         $zs = IHashMap\Module::putEntry($xs, ITuple\Type::box2($k, $ys));
         return $zs;
     }
     return $xs;
 }
Beispiel #2
0
 /**
  * This method tests the "delete" method.
  *
  * @dataProvider data_delete
  */
 public function test_delete(array $provided, array $expected)
 {
     $p0 = ILinkedList\Type::make($provided[0], '\\Saber\\Data\\IInt32\\Type');
     $p1 = IInt32\Type::box($provided[1]);
     $r0 = ILinkedList\Module::delete($p0, $p1);
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\ILinkedList\\Type', $r0);
     $this->assertSame($e0, $r0->unbox(1));
 }