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
  • 151,199
  • 17
  • 111
  • 216
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
  • 107,438
  • 16
  • 129
  • 179