ArrayList<Double> searchlist = new ArrayList<Double>();
Iterator<Values> it = facetvalues.iterator();
//the objects copied to a hash map with cost as key and count as value. The costs are also copied into an array list which will be used later
while(it.hasNext()){
Values temp = it.next();
facethash.put(Double.parseDouble(temp.getName()), temp.getCount());
searchlist.add(Double.parseDouble(temp.getName()));
}
int index = searchlist(averagecost, searchlist); //This function is used to retrieve the index of cost that is similar to the user's average product cost
System.out.println("index is " + index);
System.out.println(searchlist.get(index));