From 6b7ee831d9f1f9b9d8836448cd5588a5490f79e2 Mon Sep 17 00:00:00 2001 From: Emir Pasic Date: Thu, 5 Mar 2015 16:58:35 +0100 Subject: [PATCH] set interface --- sets/hashset/hashset.go | 5 +++++ sets/sets.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 sets/sets.go diff --git a/sets/hashset/hashset.go b/sets/hashset/hashset.go index e45a4df..16e1619 100644 --- a/sets/hashset/hashset.go +++ b/sets/hashset/hashset.go @@ -24,9 +24,14 @@ package hashset import ( "fmt" + "github.com/emirpasic/gods/sets" "strings" ) +func assertInterfaceImplementation() { + var _ sets.Interface = (*Set)(nil) +} + type Set struct { items map[interface{}]struct{} } diff --git a/sets/sets.go b/sets/sets.go new file mode 100644 index 0000000..07276e1 --- /dev/null +++ b/sets/sets.go @@ -0,0 +1,29 @@ +/* +Copyright (c) Emir Pasic, All rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 3.0 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library. See the file LICENSE included +with this distribution for more information. +*/ + +package sets + +type Interface interface { + Add(items ...interface{}) + Remove(items ...interface{}) + Contains(items ...interface{}) bool + Empty() bool + Size() int + Clear() + Values() []interface{} +}