github.com/alexandrestein/gods@v1.0.1/maps/maps.go (about) 1 // Copyright (c) 2015, Emir Pasic. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package maps provides an abstract Map interface. 6 // 7 // In computer science, an associative array, map, symbol table, or dictionary is an abstract data type composed of a collection of (key, value) pairs, such that each possible key appears just once in the collection. 8 // 9 // Operations associated with this data type allow: 10 // - the addition of a pair to the collection 11 // - the removal of a pair from the collection 12 // - the modification of an existing pair 13 // - the lookup of a value associated with a particular key 14 // 15 // Reference: https://en.wikipedia.org/wiki/Associative_array 16 package maps 17 18 import "github.com/alexandrestein/gods/containers" 19 20 // Map interface that all maps implement 21 type Map interface { 22 Put(key interface{}, value interface{}) 23 Get(key interface{}) (value interface{}, found bool) 24 Remove(key interface{}) 25 Keys() []interface{} 26 27 containers.Container 28 // Empty() bool 29 // Size() int 30 // Clear() 31 // Values() []interface{} 32 } 33 34 // BidiMap interface that all bidirectional maps implement (extends the Map interface) 35 type BidiMap interface { 36 GetKey(value interface{}) (key interface{}, found bool) 37 38 Map 39 }