package com.bestchoice.bo;

import java.util.*;

import com.bestchoice.model.PriceReview;
import com.bestchoice.model.Products;
import com.bestchoice.util.Loadlist;

public class MakeBestChoiceLogic {

	public void getBestChoiceList(List<String> desiredProducts, double budgetAmt) {
		Loadlist load = new Loadlist();
		List<Products> list = load.fetchProducts(desiredProducts);
		System.out.println(list);
		// MckpExactlyOne mckp = new MckpExactlyOne();
		// int n = list.size();

	}

	public void separateProducts(List<Products> list) {
		LinkedHashMap<String, ArrayList<PriceReview>> hm = new LinkedHashMap<>();
		for (Products prods : list) {
			String prodName = prods.getProductName();
			if (!hm.containsKey(prodName)) {
				ArrayList<PriceReview> ar = new ArrayList<>();
				ar.add(new PriceReview(prods.getPrice(), prods.getReviewValue()));
				hm.put(prodName, ar);
			} else {
				ArrayList<PriceReview> ar = new ArrayList<>(hm.get(prodName));
				ar.add(new PriceReview(prods.getPrice(), prods.getReviewValue()));
				hm.put(prodName, ar);
			}
		}
		int n = hm.size(), i = 0, m;
		double wt[][] = new double[n][];
		double val[][] = new double[n][];
		for (String s : hm.keySet()) {
			ArrayList<PriceReview> arr = new ArrayList<>(hm.get(s));
			m = arr.size();
			for (int j = 0; j < m; j++) {
				wt[i][j] = arr.get(j).getReview();
				val[i][j] = arr.get(j).getAmount();
			}
			i++;
		}

	}

}

package com.bestchoice.bo;

import java.util.*;

import com.bestchoice.model.PriceReview;
import com.bestchoice.model.Products;
import com.bestchoice.util.Loadlist;

public class MakeBestChoiceLogic {

	public void getBestChoiceList(List<String> desiredProducts, double budgetAmt) {
		Loadlist load = new Loadlist();
		List<Products> list = load.fetchProducts(desiredProducts);
		separateProducts(list);
		System.out.println(list);
		// MckpExactlyOne mckp = new MckpExactlyOne();
		// int n = list.size();

	}

	public void separateProducts(List<Products> list) {
		int sz = list.size();
		LinkedHashMap<String, ArrayList<PriceReview>> hm = new LinkedHashMap<>();
		for (Products prods : list) {
			String prodName = prods.getProductName();
			if (!hm.containsKey(prodName)) {
				ArrayList<PriceReview> ar = new ArrayList<>();
				ar.add(new PriceReview(prods.getPrice(), prods.getReviewValue()));
				hm.put(prodName, ar);
			} else {
				ArrayList<PriceReview> ar = new ArrayList<>(hm.get(prodName));
				ar.add(new PriceReview(prods.getPrice(), prods.getReviewValue()));
				hm.put(prodName, ar);
			}
		}

		int n = hm.size(), i = 0, m;
		double wt[][] = new double[n][sz - n];
		double val[][] = new double[n][sz - n];
		for (String s : hm.keySet()) {
			ArrayList<PriceReview> arr = new ArrayList<>(hm.get(s));
			m = arr.size();
			for (int j = 0; j < m; j++) {
				wt[i][j] = arr.get(j).getReview();
				val[i][j] = arr.get(j).getAmount();
			}
			i++;
		}
		System.out.println("Hi");
	}

}

Work in progress.