Skip to content
Snippets Groups Projects
Commit af3b877f authored by Joonatan Kaija's avatar Joonatan Kaija
Browse files

lisäyksiä

parent 017885fe
Branches
Tags
No related merge requests found
Pipeline #64075 passed
...@@ -26,11 +26,14 @@ public class Main { ...@@ -26,11 +26,14 @@ public class Main {
HashSet<HenkiloAuto> henkiloautot = new HashSet<HenkiloAuto>(); HashSet<HenkiloAuto> henkiloautot = new HashSet<HenkiloAuto>();
HashSet<KuormaAuto> kuormaautot = new HashSet<KuormaAuto>(); HashSet<KuormaAuto> kuormaautot = new HashSet<KuormaAuto>();
*/ */
//random map demonstraatio
//luodaan Map, johon asetetaan avain-arvo pareja
Map<String, String> alkuperäinen = new HashMap<>(); Map<String, String> alkuperäinen = new HashMap<>();
alkuperäinen.put("avain1", "arvo1"); alkuperäinen.put("avain1", "arvo1");
alkuperäinen.put("avain2", "arvo2"); alkuperäinen.put("avain2", "arvo2");
alkuperäinen.put("avain3", "arvo3"); alkuperäinen.put("avain3", "arvo3");
//luodaan uusi RandomMap jolle annetaan aikaisemmin luotu Map
Map<String, String>randomMap = new RandomMap<>(alkuperäinen); Map<String, String>randomMap = new RandomMap<>(alkuperäinen);
String testi1 = randomMap.get("avain1"); // palauttaa arvo1 String testi1 = randomMap.get("avain1"); // palauttaa arvo1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment