private String getCost(List<OrderObject> orderObjects, String name) { Double cost = 0.0; for (OrderObject object : orderObjects) { if (object.getName().equals(name)) { cost = object.getCost(); } } return cost.toString(); }