When I run this program:-
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
public class try1 {
public static void main(String args[]) {
Map<String, Object> props = new HashMap<String, Object>();
props.putIfAbsent("videos", new LinkedHashSet<String>());
System.out.println(LinkedHashSet<String>(props.get("videos")).add("video_url");
}
}
I get 3 errors :-
try1.java:14: error: cannot find symbol
System.out.println(LinkedHashSet<String>(props.get("videos")).add("yoyo"));//.add("video_url");
^
symbol: variable LinkedHashSet
location: class try1
try1.java:14: error: cannot find symbol
System.out.println(LinkedHashSet<String>(props.get("videos")).add("yoyo"));//.add("video_url");
^
symbol: variable String
location: class try1
try1.java:14: error: cannot find symbol
System.out.println(LinkedHashSet<String>(props.get("videos")).add("yoyo"));//.add("video_url");
^
symbol: method add(String)
location: class Object
3 errors
I am trying to use HashMap value as LinkedHashSet, but getting these errors. What shall I do?