Permalink
Browse files

Added clear method to Library.

  • Loading branch information...
1 parent dd80a3d commit 665d86bc0f9f61e24706fce69444a1a6f9afbf77 Nicolas Gramlich committed Dec 12, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/org/andengine/util/adt/map/Library.java
@@ -37,21 +37,25 @@ public Library(final int pInitialCapacity) {
// Getter & Setter
// ===========================================================
+ public T get(final int pID) {
+ return this.mItems.get(pID);
+ }
+
public void put(final int pID, final T pItem) {
- final T existingItem = this.mItems.get(pID);
- if(existingItem == null) {
+ final T item = this.mItems.get(pID);
+ if(item == null) {
this.mItems.put(pID, pItem);
} else {
- throw new IllegalArgumentException("ID: '" + pID + "' is already associated with item: '" + existingItem.toString() + "'.");
+ throw new IllegalArgumentException("ID: '" + pID + "' is already associated with item: '" + item.toString() + "'.");
}
}
public void remove(final int pID) {
this.mItems.remove(pID);
}
- public T get(final int pID) {
- return this.mItems.get(pID);
+ public void clear() {
+ this.mItems.clear();
}
// ===========================================================

0 comments on commit 665d86b

Please sign in to comment.