Skip to content

Instantly share code, notes, and snippets.

@oupo
Created March 11, 2014 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oupo/9483237 to your computer and use it in GitHub Desktop.
Save oupo/9483237 to your computer and use it in GitHub Desktop.
class Set<K> {
var map: Map<K,Bool>;
public function new() {
this.map = new Map<K,Bool>();
}
public function add(k:K): Void {
this.map.set(k, true);
}
public function has(k:K): Bool {
return this.map.exists(k);
}
public function iterator(): Iterator<K> {
return this.map.keys();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment