Skip to content

Commit

Permalink
Merge pull request wangzheng0822#239 from milley/master
Browse files Browse the repository at this point in the history
fixed lru array removeAndCache
  • Loading branch information
wangzheng0822 authored Jan 28, 2019
2 parents 6dc4d2b + 10dd677 commit 0616eae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*.tar.gz
*.rar
*.DS_Store
*.exe

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
Expand Down
3 changes: 2 additions & 1 deletion java/06_linkedlist/LRUBasedArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public void cache(T object, int end) {
* @param object
*/
public void removeAndCache(T object) {
value[--count] = null;
T key = value[--count];
holder.remove(key);
cache(object, count);
}

Expand Down

0 comments on commit 0616eae

Please sign in to comment.