Skip to content

Instantly share code, notes, and snippets.

@matagat
Created July 31, 2021 10:12
Show Gist options
  • Select an option

  • Save matagat/ec7ca389d67e3f7e4b0094f01de53880 to your computer and use it in GitHub Desktop.

Select an option

Save matagat/ec7ca389d67e3f7e4b0094f01de53880 to your computer and use it in GitHub Desktop.
DAO Fail
/*
* 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