I initialized the set in slightly different way. What is wrong with the validator?
package com.codegym.task.task08.task0801;
/*
HashSet of plants
*/
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Solution {
public static void main(String[] args) throws Exception {
HashSet<String> set = new HashSet<>(Arrays.asList("watermelon", "banana", "cherry", "pear", "cantaloupe", "blackberry",
"ginseng", "strawberry", "iris", "potato"));
/*Scanner sc = new Scanner(System.in);
for (int i = 0; i < 10; i++) {
set.add(sc.nextLine());
}*/
for (String s : set) {
System.out.println(s);
}
}
}