Beispiel #1
0
 public boolean contains(Article article) {
   for (Wish wish : wishes) {
     Long searchId = article.getId();
     Long idInWishList = wish.getArticle().getId();
     if (searchId.equals(idInWishList)) {
       return true;
     }
   }
   return false;
 }
Beispiel #2
0
 public void removeFromWishList(Article article) {
   if (contains(article)) {
     Wish wishToRemove = null;
     for (Wish wish : wishes) {
       if (wish.getArticle().getId().equals(article.getId())) {
         wishToRemove = wish;
         break;
       }
     }
     wishes.remove(wishToRemove);
   }
 }