Well I have a Collection of Books that I need to use to write methods from an Interface. But I don`t know how to access the attributes or methods from the object inside this collection.
I tried to implement like this but its says "type mismatch: cannot convert from element type Object to Book".
public class MyCozyLibrary implements SmallLibrary {
private Collection allBooks;
@Override
public Book getBook(BookTag tag) {
for (Book book : allBooks) {
if (tag == book.getTag()) {
return book;
}
}
return null;
}