Initial commit
This commit is contained in:
commit
054b77ccdd
27 files changed
+1362
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Bag {
|
||||
private List<Book> liBag;
|
||||
|
||||
public Bag() {
|
||||
this.liBag = new ArrayList<Book>();
|
||||
}
|
||||
|
||||
public void add(Book bk) {
|
||||
this.liBag.add(bk);
|
||||
}
|
||||
|
||||
public boolean del(String inIsbn) {
|
||||
boolean flag = false;
|
||||
Book tempBk;
|
||||
for (int i = 0; i < this.liBag.size(); i++) {
|
||||
tempBk = this.liBag.get(i);
|
||||
if (tempBk.getStrIsbn().equals(inIsbn)) {
|
||||
this.liBag.remove(i);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public List<Book> getLiBag() {
|
||||
return liBag;
|
||||
}
|
||||
|
||||
public void setLiBag(List<Book> liBag) {
|
||||
this.liBag = liBag;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user