NLFormat extends Format { public List<String> formatMultiple(List<? extends Object> objList) { final String command = buildFormatMultipleCommand(objList); List<String> resultList = new ArrayList<String>(); CycList rawResult; try { rawResult = getCycAccess().converseList(command); } catch (Exception ex) { throw new RuntimeException("Exception formatting " + objList, ex); } Map<Object, String> resultMap = rawResult.toMap(); for (Object oneInput : objList) { resultList.add(resultMap.get(oneInput)); } return resultList; } protected  NLFormat(CycAccess cyc); static NLFormat getInstance(CycAccess cyc); static NLFormat getInstance(Locale locale, CycAccess cyc); @Override StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos); List<String> formatMultiple(List<? extends Object> objList); @Override Object parseObject(String source, ParsePosition pos); CycObject getFormatLanguageMt(); Object getParseLanguageMt(); Object getDomainMt(); GenerationMode getMode(); Locale getLocale(); Collection<CycObject> getRequiredIsas(); Collection<CycObject> getRequiredGenls(); void setLocale(Locale locale); void setPrecise(boolean b); boolean isPrecise(); boolean shouldDisambiguate(); void setFormatLanguageMt(CycObject languageMt); void setParseLanguageMt(CycObject languageMt); void setDomainMt(CycObject domainMt); void setMode(GenerationMode mode); void setDisambiguate(boolean shouldDisambiguate); void addRequiredIsa(CycObject isa); void addRequiredGenl(CycObject genl); List<? extends Object> parseObjects(String denotationString); Collection<? extends Object> parseObjects(String denotationString, ParsePosition pos); static final CycSymbol DEFAULT; }
@Test public void testFormatMultiple() { System.out.println("formatMultiple"); List<Integer> objList = Arrays.asList(1, 2, 3); NLFormat instance = NLFormat.getInstance(cyc); List<String> expResult = Arrays.asList("1", "2", "3"); List result = instance.formatMultiple(objList); assertEquals(expResult, result); }