-4
    List asList=Arrays.asList(text_arr);        
    Set<String> myset=new HashSet<String>(asList);

[unchecked] unchecked conversion Set myset1=new HashSet(asList1); unchecked method invocation: constructor in class HashSet is applied to given types Set myset1=new HashSet(asList1);

error found -Xlint:unchecked

captain_cold
  • 25
  • 1
  • 5

1 Answers1

0

It may be because you are declaring a List as a generic collection, but without specifying the type. You should do just what you did with the HashSet:

List<String> list = new List<String>(); // or Arrays.asList(text_arr);
HashSet<String> set = new HashSet<String>(list);

Hope it solves it.

  • List list = new List(); you cannot instantiate "new List();" , you should provide its implementation, like ArrayList<>(); – user_vs Mar 20 '18 at 04:39