package com.sourcefellows.sideeffects;

import java.util.HashMap;
import java.util.Map;

public class Main {

    public static void main(String[] args) {

        Main main = new Main();
        main.doWithMap();
        main.doWithoutMap();
    }

    private void doWithoutMap() {

        Ship titanic = new Ship("Titanic", "Kreuzfahrtschiff", "blue");

        Ships ships = new Ships();
        ships.addShip(titanic);

        Harbor shouthampton = new Harbor(ships);

    }

    private void doWithMap() {
        Ship titanic = new Ship("Titanic", "Kreuzfahrtschiff", "blue");
        Map<String, Ship> ships = new HashMap<>();
        ships.put("Titanic", titanic);

        Harbor shouthampton = new Harbor();
        shouthampton.setShips(ships);

        shouthampton.getShips().clear();
    }

}
