COMP 202 Lecture Notes - Lecture 29: Amay

55 views2 pages
jc123 and 40170 others unlocked
COMP 202 Full Course Notes
100
COMP 202 Full Course Notes
Verified Note
100 documents

Document Summary

Data structures: array, linkedlist, arraylist, object. Array (and arraylist) indexing: in an array, all values are accessed via (positive) integer indices. Hashmap indexing: a structure that allows you to index other data types. Hashmaps: structures providing an unordered set of values. Indexed by a key whose type is whatever you want. The first element in the <> denotes the type of the key and 2nd element denotes type of the value. Adds a value to the hashmap and associates it with a specific key: get(key) Return the value associated with the corresponding key: containskey(key) Returns whether or not the hashmap contains the key: containsvalue(value) returns whether or not the hashmap contains the value, remove(key) removes the key-value pair from the map, size() Returns the number of key-value pairs in the hashmap: keyset() Returns a set view of the keys contained in this map. Printing all items in a hashmap: using a for-each loop, converting to an array, using tostring();

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents