* @param product the product to set
*/
public void setProduct (final Product product);
+
+ /**
+ * Determines whether the item has a Product instance set
+ *
+ * @return Whether a Product instance is set
+ */
+ public boolean isProductType ();
}
package org.mxchange.jshopcore.model.basket;
import java.util.Deque;
-import java.util.LinkedHashMap;
import java.util.LinkedList;
-import java.util.Map;
+import java.util.List;
import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
/**
}
@Override
- public Map<Long, T> getAll () {
+ public List<T> getAll () {
// Init map
- Map<Long, T> map = new LinkedHashMap<>(this.deque.size());
+ List<T> list = new LinkedList<>();
// Iterate over full item list
for (T item : this.deque) {
}
// Add to map, use the item's id as key
- map.put(item.getItemId(), item);
+ list.add(item);
}
// Return it
- return map;
+ return list;
}
@Override
}
// Get all items
- Map<Long, T> map = this.getAll();
+ List<T> list = this.getAll();
// Default is not found
boolean isAdded = false;
- for (Map.Entry<Long, T> entrySet : map.entrySet()) {
- // Get whole item
- T i = entrySet.getValue();
-
+ // Loop through list
+ for (final T i : list) {
// Compare id
if (i.equals(item)) {
// Okay, found it
package org.mxchange.jshopcore.model.basket;
import java.io.Serializable;
-import java.util.Map;
+import java.util.List;
import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
/**
*
* @return Map on all basket items
*/
- public Map<Long, T> getAll ();
+ public List<T> getAll ();
/**
* Getter for last entry