0

I am beginner to java and i have code for BFS algorithm.

What do the angle brackets mean?

Queue<Node> q = new LinkedList<Node>().
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
H. Hamdoun
  • 19
  • 1

1 Answers1

1

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:

paulsm4
  • 114,292
  • 17
  • 138
  • 190