Skip to content

Commit

Permalink
Fix LruCache - max size of 0 caused problems
Browse files Browse the repository at this point in the history
  • Loading branch information
d0by1 committed Mar 2, 2023
1 parent c2714f1 commit 74c9dd4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public void put(String input, String result) {
if (MAP.containsKey(input)) {
QUE.remove(input);
} else {
if (QUE.size() == maxSize) {
int size = QUE.size();
if (size == maxSize && size > 0) {
String temp = QUE.removeLast();
MAP.remove(temp);
}
Expand Down

0 comments on commit 74c9dd4

Please sign in to comment.