Skip to content

Commit ee0450e

Browse files
committed
remove unnecessary variable "mySize" from ItemContainer
1 parent c0d96e2 commit ee0450e

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

main/src/org/destinationsol/game/item/ItemContainer.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class ItemContainer implements Iterable<List<SolItem>> {
2727

2828
private List<List<SolItem>> myGroups;
2929
private Set<List<SolItem>> myNewGroups;
30-
private int mySize;
3130

3231
public ItemContainer() {
3332
myGroups = new ArrayList<List<SolItem>>();
@@ -72,17 +71,15 @@ public void add(SolItem addedItem) {
7271
if ((group.size() < MAX_GROUP_SZ))
7372
{
7473
group.add(addedItem);
75-
mySize++;
7674
}
7775
return;
7876

7977
}
8078
}
8179
if (myGroups.size() >= MAX_GROUP_COUNT) throw new AssertionError("reached group count limit");
82-
ArrayList<SolItem> group = new ArrayList<SolItem>();
80+
ArrayList<SolItem> group = new ArrayList<>();
8381
group.add(addedItem);
8482
myGroups.add(0, group);
85-
mySize++;
8683
myNewGroups.add(group);
8784
}
8885

@@ -95,10 +92,6 @@ public int groupCount() {
9592
return myGroups.size();
9693
}
9794

98-
public int size() {
99-
return mySize;
100-
}
101-
10295
public boolean contains(SolItem item) {
10396
for (int i = 0, myGroupsSize = myGroups.size(); i < myGroupsSize; i++) {
10497
List<SolItem> group = myGroups.get(i);
@@ -116,7 +109,6 @@ public void remove(SolItem item) {
116109
if (group.isEmpty()) remGroup = group;
117110
if (removed) break;
118111
}
119-
if (removed) mySize--;
120112
if (remGroup != null) {
121113
myGroups.remove(remGroup);
122114
myNewGroups.remove(remGroup);
@@ -165,7 +157,6 @@ public List<SolItem> getGroup(int groupIdx) {
165157
public void clear() {
166158
myGroups.clear();
167159
myNewGroups.clear();
168-
mySize = 0;
169160
}
170161

171162
private class Itr implements Iterator<List<SolItem>> {

0 commit comments

Comments
 (0)