// 一個阻塞的線程安全的隊(duì)列
private LinkedBlockingQueue<ErrorMsgVO> errorDevMsgs = new LinkedBlockingQueue<>();
if (errorDevMsgs.isEmpty()) {
}
Iterator<ErrorMsgVO> it = errorDevMsgs.iterator();
while (it.hasNext()) {
ErrorMsgVO t = it.next();
}
方法 |
說明 |
解釋 |
add |
增加一個元索 |
如果隊(duì)列已滿,則拋出一個IIIegaISlabEepeplian異常 |
offer |
添加一個元素并返回true |
如果隊(duì)列已滿悯辙,則返回false |
put |
添加一個元素 |
如果隊(duì)列已滿背零,則阻塞 |
|
poll |
移除并返問隊(duì)列頭部的元素 |
如果隊(duì)列為空喷楣,則返回null |
remove |
移除并返回隊(duì)列頭部的元素 |
如果隊(duì)列為空,則拋出一個NoSuchElementException異常 |
peek |
返回隊(duì)列頭部的元素 |
如果隊(duì)列為空恩伺,則返回null |
element |
返回隊(duì)列頭部的元素 |
如果隊(duì)列為空赴背,則拋出一個NoSuchElementException異常 |
take |
移除并返回隊(duì)列頭部的元素 |
如果隊(duì)列為空,則阻塞 |