Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.github.chriscgalbraith.structalg;
- import java.util.ArrayList;
- import java.util.Map;
- import java.util.TreeMap;
- public class Dealership {
- private TreeMap<String, TreeMap<String, ArrayList<Car>>> myDoubleTree;
- String make;
- String model;
- Car car;
- public void addMake() {
- myDoubleTree.put(make, new TreeMap<>());
- }
- public void removeMake() {
- }
- public void addModel() {
- myDoubleTree.get(make).put(model, new ArrayList<>());
- }
- public void addCar() {
- myDoubleTree.get(make).get(model).add(car);
- }
- public void displayMakes() {
- for (Map.Entry<String, TreeMap<String, ArrayList<Car>>> entry : myDoubleTree.entrySet())
- {
- System.out.println(entry.getValue());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement