From 0f2ee44ad72649a13ed5913dce71532bb024489a Mon Sep 17 00:00:00 2001 From: dunera <458098102@qq.com> Date: Mon, 9 Apr 2018 00:19:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC9=E9=A2=98-=E5=A2=9E=E5=8A=A0=E5=87=BA?= =?UTF-8?q?=E9=98=9F=E4=B8=BA=E7=A9=BA=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...45\211\221\346\214\207 offer \351\242\230\350\247\243.md" | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git "a/notes/\345\211\221\346\214\207 offer \351\242\230\350\247\243.md" "b/notes/\345\211\221\346\214\207 offer \351\242\230\350\247\243.md" index 2dc15d12..6d27553b 100644 --- "a/notes/\345\211\221\346\214\207 offer \351\242\230\350\247\243.md" +++ "b/notes/\345\211\221\346\214\207 offer \351\242\230\350\247\243.md" @@ -393,11 +393,14 @@ public void push(int node) { in.push(node); } -public int pop() { +public int pop() throws Exception{ if (out.isEmpty()) { while (!in.isEmpty()) { out.push(in.pop()); } + if (out.isEmpty()){ + throw new Exception("queue is empty"); + } } return out.pop(); } -- GitLab