* This method is used to get the whether the sizes are out of stock or
* present in the database if present the sizes are shown
*
* @return string
*/
publicStringshowSizes(){
returnoutOfStock()?"* Out of Stock *":"Sizes available : "+size.entrySet().stream().map(size->size.getKey()+"-"+size.getValue()).reduce((sizes,size)->sizes+", "+size).get();
}
/**
* This method is used to get the menu of the product according to the required
StringcategoryOptions=Arrays.stream(Category.values()).filter(category->!category.equals(Category.EXIT)).map(category->"("+category.getOption()+")"+category).reduce((categories,category)->categories+" "+category).get()+"\nPress 0 to go back.";
StringcategoryOptions=Arrays.stream(Size.values()).filter(size->!size.equals(Size.EXIT)).map(size->"("+size.getOption()+")"+size).reduce((sizes,size)->sizes+" "+size).get()+"\nPress 0 to go back.";
...
...
@@ -46,6 +69,13 @@ public final class Utility {
returnsizeValue.equals(Size.EXIT)?null:sizeValue;
}
/**
* This method is used to get the gender details of the given input option
StringgenderOptions=Arrays.stream(Gender.values()).filter(gender->!gender.equals(Gender.EXIT)).map(gender->"("+gender.getOption()+")"+gender).reduce((genders,gender)->genders+" "+gender).get()+"\nPress 0 to go back.";
StringcolorOptions=Arrays.stream(Color.values()).filter(color->!color.equals(Color.EXIT)).map(color->"("+color.getOption()+")"+color).reduce((categories,category)->categories+" "+category).get()+"\nPress 0 to go back.";