From af3b877fc94925656fd5d4d79be1ffd3838fc82a Mon Sep 17 00:00:00 2001 From: Joonatan Kaija <jjkaij@utu.fi> Date: Sun, 21 May 2023 23:19:51 +0300 Subject: [PATCH] =?UTF-8?q?lis=C3=A4yksi=C3=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fi/utu/tech/ooj/exercise3/Main.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/fi/utu/tech/ooj/exercise3/Main.java b/src/main/java/fi/utu/tech/ooj/exercise3/Main.java index 3ed1b52..72f1295 100644 --- a/src/main/java/fi/utu/tech/ooj/exercise3/Main.java +++ b/src/main/java/fi/utu/tech/ooj/exercise3/Main.java @@ -26,11 +26,14 @@ public class Main { HashSet<HenkiloAuto> henkiloautot = new HashSet<HenkiloAuto>(); HashSet<KuormaAuto> kuormaautot = new HashSet<KuormaAuto>(); */ + //random map demonstraatio + //luodaan Map, johon asetetaan avain-arvo pareja Map<String, String> alkuperäinen = new HashMap<>(); alkuperäinen.put("avain1", "arvo1"); alkuperäinen.put("avain2", "arvo2"); alkuperäinen.put("avain3", "arvo3"); + //luodaan uusi RandomMap jolle annetaan aikaisemmin luotu Map Map<String, String>randomMap = new RandomMap<>(alkuperäinen); String testi1 = randomMap.get("avain1"); // palauttaa arvo1 -- GitLab