You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
zanninso feebbfeef1
fix(java-piscine): fix java piscine typos in subjects and folders names (#2078)
1 year ago
..
README.md fix(java-piscine): fix java piscine typos in subjects and folders names (#2078) 1 year ago

README.md

MapEquals

Instructions

Create a file MapEquals.java.

Write a function areMapsEqual that returns true if the maps as parameters are equal. Returns false otherwise.

Expected Functions

import java.util.Map;

public class MapEquals {
    public static boolean areMapsEqual(Map<String, Integer> map1, Map<String, Integer> map2) {
        // your code here
    }
}

Usage

Here is a possible ExerciseRunner.java to test your function:

import java.util.Map;

public class ExerciseRunner {
    public static void main(String[] args) {
        Map<String, Integer> map1 = Map.of("Alice", 1, "Bob", 2, "Charly", 3);
        Map<String, Integer> map2 = Map.of("Alice", 1, "Bob", 2, "Charly", 3);
        System.out.println(MapEquals.areMapsEqual(map1, map2)); // Expected Output: true

        Map<String, Integer> map3 = Map.of("Alice", 1, "Bob", 2, "Charly", 3);
        Map<String, Integer> map4 = Map.of("Alice", 1, "Bob", 2, "Emily", 3);
        System.out.println(MapEquals.areMapsEqual(map3, map4)); // Expected Output: false
    }
}

and its output :

$ javac *.java -d build
$ java -cp build ExerciseRunner
true
false
$

Notions

Map