Maps/AbstractMap: Difference between revisions
From charlesreid1
(Created page with "==Functions== Some absolute basic functionality that should be provided: * m[k] or m.get(k) - get the value v associated with key k in map m, returns key error * m[k] = v or...") |
No edit summary |
||
| Line 1: | Line 1: | ||
== | ==Implementation and Functionality== | ||
Some absolute basic functionality that should be provided: | Some absolute basic functionality that should be provided: | ||
| Line 8: | Line 7: | ||
* len(m) or m.size() - return the number of elements (unique keys) in the map | * len(m) or m.size() - return the number of elements (unique keys) in the map | ||
* iter(m) - iterator over keys of map | * iter(m) - iterator over keys of map | ||
| Line 19: | Line 19: | ||
The base type Map defines a large number of methods - see [[Maps/ADT]] for the full list. | The base type Map defines a large number of methods - see [[Maps/ADT]] for the full list. | ||
==Flags== | |||
{{MapsFlag}} | |||
Latest revision as of 13:58, 21 June 2017
Implementation and Functionality
Some absolute basic functionality that should be provided:
- m[k] or m.get(k) - get the value v associated with key k in map m, returns key error
- m[k] = v or m.set(k,v) or m.put(k,v) - set the value v associated with key k in map m
- del m[k] or m.remove(k) - remove the element with key k in map m
- len(m) or m.size() - return the number of elements (unique keys) in the map
- iter(m) - iterator over keys of map
Notes
Base map class. Maps are essentially key-value data structures - you pass in a key, you get back a value.
In the Java Collections framework, the Map class is the highest-level abstract class - it is actually an interface, not a class.
Java API Documentation for Map class: http://docs.oracle.com/javase/8/docs/api/java/util/Map.html
The base type Map defines a large number of methods - see Maps/ADT for the full list.
Flags
| Maps and Dictionaries Part of Computer Science Notes
Series on Data Structures
Maps/Dictionaries Maps · Maps/ADT · Maps in Java · Maps/OOP · Maps/Operations and Performance Map implementations: Maps/AbstractMap · Maps/UnsortedArrayMap · Maps/SortedArrayMap Dictionary implementations: Dictionaries/LinkedDict · Dictionaries/ArrayDict
Hashes Hash Maps/OOP · Hash Maps/Operations and Performance Hash Maps/Dynamic Resizing · Hash Maps/Collision Handling with Chaining Hash functions: Hash Functions · Hash Functions/Cyclic Permutation Hash map implementations: Hash Maps/AbstractHashMap · Hash Maps/ChainedHashMap
Skip Lists · Java/ConcurrentSkipList · Java implementations: SkipList
Sets Sets · Sets/ADT · Sets in Java · Sets/OOP · Multisets
|