collections - PriorityQueue source code initFromPriorityQueue why doing the type comparison -
i reading source code of priorityqueue, in private method initfrompriorityqueue, compared type of c priorityqueue.class, don't understand, how can not same since priorityqueue concrete class without subclass?
private void initfrompriorityqueue(priorityqueue<? extends e> c) { if (c.getclass() == priorityqueue.class) { this.queue = c.toarray(); this.size = c.size(); } else { initfromcollection(c); } }
Comments
Post a Comment