public boolean hasNext() {
   if (index < bookShelf.getLength()) {
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 2
0
  public static void main(String[] args) {

    ArrayList<String> info = new ArrayList<>();
    String[] add = new String[5];

    BookShelf tana = new BookShelf();
    info = BookReader.reader();
    for (String spl : info) {
      add = spl.split(",", 5);
      Book book = new Book(add[0], add[1], add[2], add[3], add[4]);
      tana.bookinsert(book);
    }

    System.out.println(tana.booklist);

    BookWriter.writer(tana.booklist);
  }
Exemplo n.º 3
0
 public static void main(String[] args) {
   BookShelf bookShelf = new BookShelf(4);
   bookShelf.appendBook(new Book("Around the World in 80 Days"));
   bookShelf.appendBook(new Book("Bible"));
   bookShelf.appendBook(new Book("Cinderella"));
   bookShelf.appendBook(new Book("Daddy-Long-Legs"));
   Iterator it = bookShelf.iterator();
   while (it.hasNext()) {
     Book book = (Book) it.next();
     System.out.println(book.getName());
   }
 }
 public Object next() {
   Book book = bookShelf.getBookAt(index);
   index++;
   return book;
 }