Created
May 20, 2017 18:58
-
-
Save fermopili/9e9245288f4e51e0677ca73f5202af6f to your computer and use it in GitHub Desktop.
com.javarush.task.task37.task3704
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.task.task37.task3704; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.TreeMap; | |
/* | |
Фикс бага | |
*/ | |
public class Solution | |
{ | |
public static void main(String[] args) | |
{ | |
Map expectedMap = getExpectedMap ( ); | |
System.out.println ( "********* Add obj with NULL key *********" ); | |
expectedMap.put ( null, "text 1" ); | |
System.out.println ( expectedMap.size ( ) ); | |
System.out.println ( expectedMap.get ( null ) ); | |
System.out.println ( "********* Add obj with 0 key *********" ); | |
expectedMap.put ( 0, "text 2" ); | |
System.out.println ( expectedMap.size ( ) ); | |
System.out.println ( expectedMap.get ( null ) ); | |
System.out.println ( expectedMap.get ( 0 ) ); | |
System.out.println ( "********* Keys *********" ); | |
for (Object o : expectedMap.keySet ( )) | |
{ | |
System.out.println ( o ); | |
} | |
System.out.println ( "********* Values *********" ); | |
for (Object o : expectedMap.values ( )) | |
{ | |
System.out.println ( o ); | |
} | |
/* Expected output | |
********* Add obj with NULL key ********* | |
1 | |
text 1 | |
********* Add obj with 0 key ********* | |
2 | |
text 1 | |
text 2 | |
********* Keys ********* | |
0 | |
null | |
********* Values ********* | |
text 2 | |
text 1 | |
*/ | |
} | |
public static Map getExpectedMap() | |
{ | |
return new HashMap ( ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment