public class Bag extends Object
Modifier and Type | Field and Description |
---|---|
protected Object[] |
data |
protected int |
size |
Constructor and Description |
---|
Bag() |
Bag(int initialCapacity) |
Bag(Object[] data,
int size) |
Modifier and Type | Method and Description |
---|---|
void |
add(Object o) |
boolean |
contains(Object o) |
void |
ensureCapacity(int capacity) |
Object |
get(int index) |
int |
getCapacity() |
int |
indexOf(Object o) |
int |
indexOf(Object o,
int startIndex) |
void |
insert(Object o,
int index) |
boolean |
isEmpty() |
int |
lastIndexOf(Object o) |
int |
lastIndexOf(Object o,
int startIndex) |
Object |
remove(int index) |
int |
remove(Object o) |
Object |
set(Object o,
int index) |
void |
setSize(int s) |
int |
size() |
void |
trimArray() |
protected Object[] data
protected int size
public Bag()
public Bag(int initialCapacity)
public Bag(Object[] data, int size)
public void add(Object o)
public int size()
public void setSize(int s)
public void insert(Object o, int index)
public void ensureCapacity(int capacity)
public int getCapacity()
public int remove(Object o)
public Object remove(int index)
public Object get(int index)
public boolean contains(Object o)
public boolean isEmpty()
public void trimArray()
public int indexOf(Object o)
public int indexOf(Object o, int startIndex)
public int lastIndexOf(Object o)
public int lastIndexOf(Object o, int startIndex)
Copyright © 2016. All rights reserved.