Docsity

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

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