I am beginner to java and i have code for BFS algorithm.
What do the angle brackets mean?
Queue<Node> q = new LinkedList<Node>().
I am beginner to java and i have code for BFS algorithm.
What do the angle brackets mean?
Queue<Node> q = new LinkedList<Node>().
When Collections (like Queue) were first introduced in earlier versions of Java, they could only contain "Object".
Java 5 introduced "generics", which allowed you to declare a specific TYPE a collection contains (rather than just the "object" superclass).
That's what the angle brackets mean: a generic "Queue" containing type "Node".
Look here for more details: