Add proper unit tests for double-checked-locking pattern

This commit is contained in:
Jeroen Meulemeester
2015-12-10 22:11:21 +01:00
committed by Jeroen Meulemeester
parent 29fc56002a
commit 2edc1898b1
3 changed files with 126 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package com.iluwatar.doublechecked.locking;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -38,4 +39,14 @@ public class Inventory {
}
return false;
}
/**
* Get all the items in the inventory
*
* @return All the items of the inventory, as an unmodifiable list
*/
public final List<Item> getItems() {
return Collections.unmodifiableList(items);
}
}