在我下面的方法中,我在方法的net.sf.extJWNL回調中使用了包中的方法。但是,我使用的方法會拋出一個. 我想使用 .catch 關鍵字,而不是當前的 try-catch塊。.anyMatch()Stream<Object>JWNLExceptionthrowsJWNLExceptionDictionary d = Dictionary.getDefaultResourceInstance();List<POS> POSList = new ArrayList<POS>(EnumSet.allOf(POS.class));boolean isWord = POSList.stream().anyMatch(c -> { try { return d.getIndexWord(c, word) != null; } catch (JWNLException e) { // TODO Auto-generated catch block e.printStackTrace(); return true; }});另外,我不能將它移動到一個單獨的方法,因為我需要這個方法的局部變量 -d和word(參數)
添加回答
舉報
0/150
提交
取消