@@ -11,7 +11,7 @@ namespace java.util
1111 class MapWrapper < TKey , TValue > : IDictionary < TKey , TValue >
1212 {
1313
14- readonly Map map ;
14+ readonly Map _map ;
1515
1616 /// <summary>
1717 /// Initializes a new instance.
@@ -20,78 +20,94 @@ class MapWrapper<TKey, TValue> : IDictionary<TKey, TValue>
2020 /// <exception cref="ArgumentNullException"></exception>
2121 public MapWrapper ( Map map )
2222 {
23- this . map = map ?? throw new ArgumentNullException ( nameof ( map ) ) ;
23+ this . _map = map ?? throw new ArgumentNullException ( nameof ( map ) ) ;
2424 }
2525
26+ /// <inheritdoc />
2627 public TValue this [ TKey key ]
2728 {
28- get => ( TValue ) map . get ( key ) ;
29- set => map . put ( key , value ) ;
29+ get => ( TValue ) _map . get ( key ) ;
30+ set => _map . put ( key , value ) ;
3031 }
3132
32- public ICollection < TKey > Keys => map . keySet ( ) . AsCollection < TKey > ( ) ;
33+ /// <inheritdoc />
34+ public ICollection < TKey > Keys => _map . keySet ( ) . AsCollection < TKey > ( ) ;
3335
34- public ICollection < TValue > Values => map . values ( ) . AsCollection < TValue > ( ) ;
36+ /// <inheritdoc />
37+ public ICollection < TValue > Values => _map . values ( ) . AsCollection < TValue > ( ) ;
3538
36- public int Count => map . size ( ) ;
39+ /// <inheritdoc />
40+ public int Count => _map . size ( ) ;
3741
42+ /// <inheritdoc />
3843 public bool IsReadOnly => false ;
3944
40- public void Add ( TKey key , TValue value ) => map . put ( key , value ) ;
45+ /// <inheritdoc />
46+ public void Add ( TKey key , TValue value ) => _map . put ( key , value ) ;
4147
42- public void Add ( KeyValuePair < TKey , TValue > item ) => map . put ( item . Key , item . Value ) ;
48+ /// <inheritdoc />
49+ public void Add ( KeyValuePair < TKey , TValue > item ) => _map . put ( item . Key , item . Value ) ;
4350
44- public void Clear ( ) => map . clear ( ) ;
51+ /// <inheritdoc />
52+ public void Clear ( ) => _map . clear ( ) ;
4553
54+ /// <inheritdoc />
4655 public bool Contains ( KeyValuePair < TKey , TValue > item )
4756 {
48- return map . containsKey ( item . Key ) && map . get ( item . Key ) . Equals ( item . Value ) ;
57+ return _map . containsKey ( item . Key ) && _map . get ( item . Key ) . Equals ( item . Value ) ;
4958 }
5059
60+ /// <inheritdoc />
5161 public bool ContainsKey ( TKey key )
5262 {
53- return map . containsKey ( key ) ;
63+ return _map . containsKey ( key ) ;
5464 }
5565
66+ /// <inheritdoc />
5667 public void CopyTo ( KeyValuePair < TKey , TValue > [ ] array , int arrayIndex )
5768 {
5869 foreach ( var entry in this )
5970 array [ arrayIndex ++ ] = entry ;
6071 }
6172
73+ /// <inheritdoc />
6274 public IEnumerator < KeyValuePair < TKey , TValue > > GetEnumerator ( )
6375 {
64- return map . entrySet ( ) . AsEnumerable < Map . Entry > ( ) . Select ( i => new KeyValuePair < TKey , TValue > ( ( TKey ) i . getKey ( ) , ( TValue ) i . getValue ( ) ) ) . GetEnumerator ( ) ;
76+ return _map . entrySet ( ) . AsEnumerable < Map . Entry > ( ) . Select ( i => new KeyValuePair < TKey , TValue > ( ( TKey ) i . getKey ( ) , ( TValue ) i . getValue ( ) ) ) . GetEnumerator ( ) ;
6577 }
6678
79+ /// <inheritdoc />
6780 public bool Remove ( TKey key )
6881 {
69- if ( map . containsKey ( key ) )
82+ if ( _map . containsKey ( key ) )
7083 {
71- map . remove ( key ) ;
84+ _map . remove ( key ) ;
7285 return true ;
7386 }
7487
7588 return false ;
7689 }
7790
91+ /// <inheritdoc />
7892 public bool Remove ( KeyValuePair < TKey , TValue > item )
7993 {
80- return map . remove ( item . Key , item . Value ) ;
94+ return _map . remove ( item . Key , item . Value ) ;
8195 }
8296
97+ /// <inheritdoc />
8398 public bool TryGetValue ( TKey key , out TValue value )
8499 {
85- if ( map . containsKey ( key ) )
100+ if ( _map . containsKey ( key ) )
86101 {
87- value = ( TValue ) map . get ( key ) ;
102+ value = ( TValue ) _map . get ( key ) ;
88103 return true ;
89104 }
90105
91- value = default ;
106+ value = default ! ;
92107 return false ;
93108 }
94109
110+ /// <inheritdoc />
95111 IEnumerator IEnumerable . GetEnumerator ( )
96112 {
97113 return GetEnumerator ( ) ;
0 commit comments