Given the example code:
Comparator<Node> comparator = this.createCompartor(algorithmChoice , matrix);
this.m_openList1 = new PriorityQueue<Node>(100, comparator);
What does the 100 in the PriorityQueue constructor stand for?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s the initial capacity of the
PriorityQueue. You would generally specify the initial capacity explicitly if you knew before hand how many items you were going to add (or had an approximation).This can also be seen in the documentation:
In fact, most collections in Java have constructors that take an int argument specifying the initial capacity.