func (s *Set) HashEqual(raw interface{}) bool {
	other, ok := raw.(*Set)
	if !ok {
		return false
	}
	ks1 := make([]string, 0)
	ks2 := make([]string, 0)
	for k := range s.m {
		ks1 = append(ks1, k)
	}
	for k := range other.m {
		ks2 = append(ks2, k)
	}
	sort.Strings(ks1)
	sort.Strings(ks2)
	return reflect.DeepEqual(ks1, ks2)
}
HashEqual simply checks to the keys the top-level map to the keys in the
other set's top-level map to see if they are equal. This obviously assumes
you have a properly working hash function - use HashResource if in doubt.
package schema
import (
	"bytes"
	"fmt"
	"reflect"
	"sort"
	"strconv"
	"sync"
	"github.com/hashicorp/terraform/helper/hashcode"
)
func HashString(v interface{}) int {
	return hashcode.String(v.(string))
}
func HashResource(resource *Resource) SchemaSetFunc {
	return func(v interface{}) int {
		var buf bytes.Buffer
		SerializeResourceForHash(&buf, v, resource)
		return hashcode.String(buf.String())
	}
}
func HashSchema(schema *Schema) SchemaSetFunc {
	return func(v interface{}) int {
		var buf bytes.Buffer
		SerializeValueForHash(&buf, v, schema)
		return hashcode.String(buf.String())
	}
}
type Set struct {
	F SchemaSetFunc
	m    map[string]interface{}
	once sync.Once
}
func NewSet(f SchemaSetFunc, items []interface{}) *Set {
	s := &Set{F: f}
	for _, i := range items {
		s.Add(i)
	}
	return s
}
func CopySet(otherSet *Set) *Set {
	return NewSet(otherSet.F, otherSet.List())
}
func (s *Set) Add(item interface{}) {
	s.add(item, false)
}
func (s *Set) Remove(item interface{}) {
	s.remove(item)
}
func (s *Set) Contains(item interface{}) bool {
	_, ok := s.m[s.hash(item)]
	return ok
}
func (s *Set) Len() int {
	return len(s.m)
}
func (s *Set) List() []interface{} {
	result := make([]interface{}, len(s.m))
	for i, k := range s.listCode() {
		result[i] = s.m[k]
	}
	return result
}
func (s *Set) Difference(other *Set) *Set {
	result := &Set{F: s.F}
	result.once.Do(result.init)
	for k, v := range s.m {
		if _, ok := other.m[k]; !ok {
			result.m[k] = v
		}
	}
	return result
}
func (s *Set) Intersection(other *Set) *Set {
	result := &Set{F: s.F}
	result.once.Do(result.init)
	for k, v := range s.m {
		if _, ok := other.m[k]; ok {
			result.m[k] = v
		}
	}
	return result
}
func (s *Set) Union(other *Set) *Set {
	result := &Set{F: s.F}
	result.once.Do(result.init)
	for k, v := range s.m {
		result.m[k] = v
	}
	for k, v := range other.m {
		result.m[k] = v
	}
	return result
}
func (s *Set) Equal(raw interface{}) bool {
	other, ok := raw.(*Set)
	if !ok {
		return false
	}
	return reflect.DeepEqual(s.m, other.m)
}