Customizing the equality function¶
ArrayList supports the
contains (G item)
its equality function can be customized by providing an
implementation of EqualDataFunc
.
bool same_book (Book a, Book b) {
return a.isbn == b.isbn;
}
var books = new Gee.ArrayList<Book> ((EqualDataFunc) same_book);
Other delegates such as
CompareDataFunc
and HashDataFunc
apply to other Collections.