Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package application;
- import java.util.ArrayList;
- import java.util.List;
- public class Magazine {
- public List<Product> listOfProducts = new ArrayList<>();
- private Magazine(){
- listOfProducts.add(new Product("123456789", "Milk", "3.50"));
- listOfProducts.add(new Product("789456123", "Bread", "2.39"));
- listOfProducts.add(new Product("123789456", "Tomato", "2.00"));
- listOfProducts.add(new Product("789123456", "Chees", "2.90"));
- listOfProducts.add(new Product("456789123", "Butter", "8.90"));
- listOfProducts.add(new Product("987654321", "Sousage", "6.40"));
- listOfProducts.add(new Product("3569258", "Nutella", "15.00"));
- }
- public static Magazine getInstance(){
- return MagazineHolder.INSTANCE;
- }
- private static class MagazineHolder{
- private static final Magazine INSTANCE = new Magazine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement