Skip to content

Commit 3543350

Browse files
ramarro123Grover-c13
authored andcommittedJul 26, 2016
getItemsCount function (#224)
* get total space used by items * get total space used by items * add javadoc
1 parent b75a434 commit 3543350

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎src/main/java/com/pokegoapi/api/inventory/ItemBag.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,17 @@ public Item getItem(ItemId type) {
112112
public Collection<Item> getItems() {
113113
return items.values();
114114
}
115+
116+
/**
117+
* Get used space inside of player inventory.
118+
*
119+
* @return used space
120+
*/
121+
public int getItemsCount() {
122+
int ct = 0;
123+
for (Item item : items.values()) {
124+
ct += item.getCount();
125+
}
126+
return ct;
127+
}
115128
}

0 commit comments

Comments
 (0)
Please sign in to comment.