Created
July 31, 2021 10:12
-
-
Save matagat/ec7ca389d67e3f7e4b0094f01de53880 to your computer and use it in GitHub Desktop.
DAO Fail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * To change this license header, choose License Headers in Project Properties. | |
| * To change this template file, choose Tools | Templates | |
| * and open the template in the editor. | |
| */ | |
| package dao; | |
| import domain.Product; | |
| import java.util.ArrayList; | |
| import java.util.Collection; | |
| /** | |
| * | |
| * @author matag | |
| */ | |
| public class ProductCollectionsDAO{ | |
| public Collection<Product> proucts; | |
| public static Collection<String> categories = new ArrayList<>(); | |
| private static Collection<Product> products = new ArrayList<>(); | |
| public void saveProduct(Product product){ | |
| products.add(product); | |
| getCategories(); | |
| // catagories.add(products.getCategories()); | |
| } | |
| public Collection<Product> getProducts(){ | |
| return products; | |
| } | |
| public void removeProuct(Product product){ | |
| products.remove(product); | |
| } | |
| public Collection<String> getCategories(){ | |
| // for(String x : products.iterator()) | |
| System.out.println(products.toString()); | |
| // for(Product c : products){ | |
| // catagories.add() | |
| // } | |
| return categories; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment