在我下面的方法中,我在方法的net.sf.extJWNL回調(diào)中使用了包中的方法。但是,我使用的方法會(huì)拋出一個(gè). 我想使用 .catch 關(guān)鍵字,而不是當(dāng)前的 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òng)到一個(gè)單獨(dú)的方法,因?yàn)槲倚枰@個(gè)方法的局部變量 -d和word(參數(shù))
在回調(diào)中使用“throws”關(guān)鍵字
喵喵時(shí)光機(jī)
2023-06-21 16:04:23