Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

compare 2 hashmap

@Test
public void whenCompareTwoHashMapsUsingEquals_thenSuccess() {
    Map<String, String> asiaCapital1 = new HashMap<String, String>();
    asiaCapital1.put("Japan", "Tokyo");
    asiaCapital1.put("South Korea", "Seoul");

    Map<String, String> asiaCapital2 = new HashMap<String, String>();
    asiaCapital2.put("South Korea", "Seoul");
    asiaCapital2.put("Japan", "Tokyo");

    Map<String, String> asiaCapital3 = new HashMap<String, String>();
    asiaCapital3.put("Japan", "Tokyo");
    asiaCapital3.put("China", "Beijing");

    assertTrue(asiaCapital1.equals(asiaCapital2));
    assertFalse(asiaCapital1.equals(asiaCapital3));
}
Comment

PREVIOUS NEXT
Code Example
Java :: single level inheritance in java 
Java :: stream reduce 
Java :: java create a string 
Java :: android studio convert java to kotlin 
Java :: what is method in java 
Java :: java servlet life cycle 
Java :: navigation graph setup android 
Java :: run specific test case junit 
Java :: java add values to array 
Java :: java hashmap 
Java :: private method in interface java 
Java :: how to divide a double in java 
Java :: round int java 
Java :: my canvas java 
Java :: java check if array element is null 
Java :: deep content 
Java :: update a key in the firebase realtime database java 
Java :: Multi basic auth with spring security 
Java :: how to declare a variable when using loops Java 
Java :: android pick up photo from local device 
Java :: how to repeat string in java 
Java :: Transversal operation in java array 
Java :: prime numbers most efficient algorithm java 
Java :: java deserialize json array 
Java :: filterreader converts a string to uppercase java 
Java :: java thyemleaf save table form to database 
Java :: more parameters java sql @PathVariable 
Java :: linearview 2 items next to each other 
Java :: how is boolean array initialized if no input is given java 
Java :: media style dependency androidx 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =