Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package day7.conteiner;
- import java.util.ArrayList;
- /**
- * Created by admin on 7/27/2016.
- */
- public class Box<T> {
- private ArrayList<T> obj;
- public Box(){
- obj = new ArrayList<>();
- }
- public void addObj(T t){
- obj.add(t);
- }
- public T getObj(int index){
- return obj.get(index);
- }
- public void removeObj(int index){
- obj.remove(index);
- }
- public void removeObject(T t){
- obj.remove(t);
- }
- public void printBox(){
- for (Object o:obj){
- System.out.println(o.toString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement