Understanding Maps as Abstract Data Types in Java: Interface and Implementation, Study notes of Java Programming

An overview of Maps as an Abstract Data Type (ADT) in Java, explaining their structure as key-value pairs, the use of interfaces for implementation, and examples of hashmaps and BSTmaps. It also includes Java code snippets for putting, getting, and removing values from a map.

Typology: Study notes

2021/2022

Uploaded on 10/10/2022

yngve99
yngve99 🇸🇪

5

(2)

65 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Structured Programming 1110/1140/6710
The Map ADT
A Map interface and its implementation
ADT Recap
Abstract Data Types:
Maps
pf3
pf4
pf5

Partial preview of the text

Download Understanding Maps as Abstract Data Types in Java: Interface and Implementation and more Study notes Java Programming in PDF only on Docsity!

Structured Programming 1110/1140/ The Map ADT A Map interface and its implementation ADT Recap

Abstract Data Types:

Maps

Structured Programming 1110/1140/

ADT Recap

Abstract Data Types: Maps

First-principles implementation of three Java container types:

  • List
    • ArrayList, LinkedList implementations (A1, A2)
  • Set
    • HashSet, BSTSet implementations (A3, A4, A5)
  • Map
    • HashMap, BSTMap implementations (A6) Introduced hash tables, trees (A4, A5)

A

Structured Programming 1110/1140/

Our Map Interface

Abstract Data Types: Maps

We will explore maps using a simple interface: public interface Map<K,V> { V put(K key, V value); V get(K key); V remove (K key); int size(); }

A

Structured Programming 1110/1140/ fruit

Abstract Data Types: Maps A

orange apple banana pear apricot peach mango plum grape cherry a-f g-m n-t u-z 3.50 2.50 5.50 12. 11.25 7. 4.00 4.00 6.00 4. fruit.getfruit.putfruit.put(“apricot”)(“grape”, 7.00)(“orange”, 3.50)

apricotorangegrape