Collection>Queue // 1. 新增 add/ offer boolean add(E e); // 队列满,IllegalStateException boolean offer(E e); // 队列满,false // 2. 移除提取列头-删除 remove/ poll E remove(); // 队列空,NoSuchElementException E poll(); // 对裂空,null // 3. 探头-不删除 element/ peek E element(); // 队列空,NoSuchElementException E peek(); // 对裂空,null Collection>Queue>BlockingQueue // 4. 阻塞方法 take/ put E take() throws InterruptedException; // 队列空,阻塞,一直到有元素放入 void put(E e) throws InterruptedException; // 队列满,阻塞,一直到有空位置再放入
java-Queue方法
猜你喜欢
转载自niewj.iteye.com/blog/2381646
今日推荐
周排行