1+ /* Copyright (c) Jython Developers */
12package javatests ;
3+
24import java .util .Map ;
35import java .util .Set ;
46import java .util .Collection ;
57import java .util .HashMap ;
6- import java .util .Iterator ;
78
89/**
910 * This class is used by the test_dict2java.py test script for testing
1314 */
1415public class Dict2JavaTest {
1516
16- private Map map = null ;
17+ private Map < Object , Object > map ;
1718
18- public Dict2JavaTest (Map map ) {
19+ public Dict2JavaTest (Map < Object , Object > map ) {
1920 this .map = map ;
2021 }
21-
22- public Set entrySet () {
22+
23+ public Set < Map . Entry < Object , Object >> entrySet () {
2324 return map .entrySet ();
2425 }
2526
26- public Set keySet () {
27+ public Set < Object > keySet () {
2728 return map .keySet ();
2829 }
2930
30- public Collection values () {
31+ public Collection < Object > values () {
3132 return map .values ();
3233 }
3334
@@ -41,7 +42,7 @@ public boolean containsKey(Object key) {
4142 }
4243
4344 public boolean test_putAll_efg () {
44- HashMap hmap = new HashMap ();
45+ HashMap < String , String > hmap = new HashMap < String , String > ();
4546 hmap .put ("e" , "1" );
4647 hmap .put ("f" , null );
4748 hmap .put ("g" , "2" );
@@ -70,29 +71,29 @@ public boolean test_put_hig() {
7071
7172 public boolean test_java_mapentry () {
7273 // created outside of Jython with non PyOjects
73- HashMap hmap = new HashMap ();
74+ HashMap < String , Object > hmap = new HashMap < String , Object > ();
7475 hmap .put ("b" , "y" );
75- Map .Entry entry = ( Map . Entry ) hmap .entrySet ().iterator ().next ();
76+ Map .Entry < String , Object > entry = hmap .entrySet ().iterator ().next ();
7677 if (!map .entrySet ().contains (entry )) return false ;
7778
7879 // Test a number
79- hmap = new HashMap ();
80+ hmap = new HashMap < String , Object > ();
8081 hmap .put ("i" , new Integer (3 ));
81- entry = ( Map . Entry ) hmap .entrySet ().iterator ().next ();
82+ entry = hmap .entrySet ().iterator ().next ();
8283 if (!map .entrySet ().contains (entry )) return false ;
8384
8485 // test Null
85- hmap = new HashMap ();
86+ hmap = new HashMap < String , Object > ();
8687 hmap .put ("f" , null );
87- entry = ( Map . Entry ) hmap .entrySet ().iterator ().next ();
88+ entry = hmap .entrySet ().iterator ().next ();
8889 if (!map .entrySet ().contains (entry )) return false ;
8990 return true ;
9091 }
9192
9293 // make sure nulls are handled and other object types, nulls
9394 // should never match anything in the entry set.
9495 public boolean test_entry_set_nulls () {
95- Set set = map .entrySet ();
96+ Set < Map . Entry < Object , Object >> set = map .entrySet ();
9697 return set .contains (null ) == false && set .remove (null ) == false &&
9798 set .contains (new Boolean (true )) == false && set .remove (new String ("" )) == false ;
9899 }
0 commit comments