Skip to content

Commit a0a6a1a

Browse files
committed
Added Container class.
1 parent 6a71a73 commit a0a6a1a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package myessentials.entities;
2+
3+
import com.google.common.collect.ImmutableList;
4+
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
8+
public class Container<T> {
9+
10+
protected List<T> items = new ArrayList<T>();
11+
12+
public void add(T item) {
13+
items.add(item);
14+
}
15+
16+
public void remove(T item) {
17+
items.remove(item);
18+
}
19+
20+
public boolean contains(T item) {
21+
return items.contains(item);
22+
}
23+
24+
public List<T> asList() {
25+
return ImmutableList.copyOf(items);
26+
}
27+
28+
public int size() {
29+
return items.size();
30+
}
31+
32+
public boolean isEmpty() {
33+
return items.isEmpty();
34+
}
35+
}

0 commit comments

Comments
 (0)