public static List<String> getSupportedTypeList( List<ProductType> supportedTypeList, String detectedType) { List<String> productList = new ArrayList<>(); if (detectedType != null) { productList.add(detectedType); } for (ProductType productType : supportedTypeList) { if (!productType.getType().equals(detectedType)) { productList.add(productType.getType()); } } return productList; }
public static List<ProductType> copyProductTypeList(List<ProductType> productTypeList) { List<ProductType> newProductList = new ArrayList<>(); for (ProductType p : productTypeList) { ProductType newP = new ProductType(); newP.setType(p.getType()); newP.setBox(p.getBox()); newP.setScore(p.getScore()); newProductList.add(p); } return newProductList; }