remove removes and returns the element at the head of the queue and throws a NoSuchElementException if the queue is empty poll removes and returns the element at the head of the queue. If the queue is empty, return null take removes and returns the element at the head of the queue add adds an element if the queue is full, throws a IIIegaISlabEepeplian exception offer adds an element and returns true if the queue is full, false put adds an element and blocks if the queue is full element returns the element at the head of the queue. If the queue is empty, throw a NoSuchElementException peek returns the element at the head of the queue, or null if the queue is empty
Difference between remove/poll/take, add/offer/put, element/peek in java Queue
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324518905&siteId=291194637
Ranking