File tree Expand file tree Collapse file tree 1 file changed +0
-32
lines changed
src/main/java/com/thealgorithms/datastructures/caches Expand file tree Collapse file tree 1 file changed +0
-32
lines changed Original file line number Diff line number Diff line change @@ -68,36 +68,4 @@ private void evict() {
68
68
totalCount --;
69
69
}
70
70
}
71
-
72
- public static void main (String [] args ) {
73
-
74
- // Defining capacity of cache Using Map
75
- ARCCache <String , Integer > cache = new ARCCache <>(5 );
76
- cache .put ("A" , 1 );
77
- cache .put ("B" , 2 );
78
- cache .put ("C" , 3 );
79
- cache .put ("D" , 4 );
80
- cache .put ("E" , 5 );
81
-
82
- // Printing Cache contents using enhanced for loop
83
- System .out .println ("Cache contents:" );
84
- for (Map .Entry <String , Integer > entry : cache .cache .entrySet ()) {
85
- System .out .println (entry .getKey () + ": " + entry .getValue ());
86
- }
87
-
88
- // Accessing an existing key
89
- System .out .println ("Value of key 'B': " + cache .get ("B" ));
90
-
91
- // Adding a new key
92
- cache .put ("F" , 6 );
93
-
94
- // Printing Cache contents after adding Key using enhanced for loop
95
- System .out .println ("Cache contents after adding key 'F':" );
96
- for (Map .Entry <String , Integer > entry : cache .cache .entrySet ()) {
97
- System .out .println (entry .getKey () + ": " + entry .getValue ());
98
- }
99
-
100
- // Accessing a non existing key
101
- System .out .println ("Value of key 'A': " + cache .get ("A" ));
102
- }
103
71
}
You can’t perform that action at this time.
0 commit comments