I wrote this class today but was told by my boss to just use the low-level php array functions instead.
I figured I’d post it here in case someone else (including myself in the future) finds it useful.
/**
* PHP implementation of Java HashSet
*
* @author mpelzsherman
*/
class HashSet {
private $_objects = array();
/**
* @param $o Object to be added to this set
* Returns: true if the set did not already contain the specified element.
*/
public function add($o) {
foreach($this->_objects as $obj) {
if ($obj == $o) {
return false;
}
}
$this->_objects[] = $o;
return true;
}
/**
* @param $o Object to be removed from this set
* Returns: true if the set contained the specified element.
*/
public function remove($o) {
foreach($this->_objects as $obj) {
if ($obj == $o) {
array_splice($this->_objects, $obj);
In some cases happen in time of sexual intercourse with discount cialis http://www.glacialridgebyway.com/windows/Runestone%20County%20Park.html their partner. But ED problem put http://www.glacialridgebyway.com/mid-2575 cheapest sildenafil a full stop to your inquiry and make you achieve solid erections, so you can cheerfully appreciate your night with your accomplice. So, without thinking about anything, just consult a spesildenafil tablets uk t and get the treatment for the side effects of ED drugs. This drug increase look at this website cheapest brand viagra the blood flow of the blood along the male reproductive organ wherein it leads for enough difficulties during the sessions of copulation. return true;
}
}
return false;
}
/**
* @param $o
* Returns true if this set contains the specified element.
*/
public function contains($o) {
foreach($this->_objects as $obj) {
if ($obj == $o) {
return true;
}
}
return false;
}
public function size() {
return count($this->_objects);
}
public function objects() {
return $this->_objects;
}
/**
* Removes all of the elements from this set.
*/
public function clear() {
$this->_objects = array();
}
}