Safety assertions on head and tail modifications

This commit is contained in:
Jason Tedor 2015-10-08 17:51:16 -04:00
parent 818d217ede
commit a556e31010
1 changed files with 2 additions and 0 deletions

View File

@ -604,6 +604,7 @@ public class Cache<K, V> {
if (before == null) { if (before == null) {
// removing the head // removing the head
assert head == entry;
head = after; head = after;
if (head != null) { if (head != null) {
head.before = null; head.before = null;
@ -616,6 +617,7 @@ public class Cache<K, V> {
if (after == null) { if (after == null) {
// removing tail // removing tail
assert tail == entry;
tail = before; tail = before;
if (tail != null) { if (tail != null) {
tail.after = null; tail.after = null;