File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,15 @@ impl MyHashSet {
13
13
fn new ( ) -> Self {
14
14
MyHashSet { set : HashSet :: new ( ) }
15
15
}
16
-
16
+
17
17
fn add ( & mut self , key : i32 ) {
18
18
self . set . insert ( key) ;
19
19
}
20
-
20
+
21
21
fn remove ( & mut self , key : i32 ) {
22
22
self . set . remove ( & key) ;
23
23
}
24
-
24
+
25
25
fn contains ( & self , key : i32 ) -> bool {
26
26
self . set . contains ( & key)
27
27
}
Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ impl MyHashMap {
15
15
fn new ( ) -> Self {
16
16
MyHashMap { map : HashMap :: new ( ) }
17
17
}
18
-
18
+
19
19
/** value will always be non-negative. */
20
20
fn put ( & mut self , key : i32 , value : i32 ) {
21
21
self . map . insert ( key, value) ;
22
22
}
23
-
23
+
24
24
/** Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key */
25
25
fn get ( & self , key : i32 ) -> i32 {
26
26
if self . map . get ( & key) . is_some ( ) {
@@ -29,7 +29,7 @@ impl MyHashMap {
29
29
-1
30
30
}
31
31
}
32
-
32
+
33
33
/** Removes the mapping of the specified value key if this map contains a mapping for the key */
34
34
fn remove ( & mut self , key : i32 ) {
35
35
self . map . remove ( & key) ;
You can’t perform that action at this time.
0 commit comments