UimaTypesUtils { @SuppressWarnings("unchecked") public static <T extends FeatureStructure> List<T> toList(FSArray array) { if (array == null) { return new ArrayList<T>(); } else { return (List<T>) Arrays.asList(array.toArray()); } } private  UimaTypesUtils(); static StringArray toArray(JCas jCas, Collection<String> collection); static String[] toArray(StringArray array); @SuppressWarnings("unchecked") static List<T> toList(FSArray array); static List<String> toList(StringArray array); static FSArray toFSArray(JCas jCas, Collection<? extends FeatureStructure> collection); static FSArray toFSArray(JCas jCas, FeatureStructure... fses);  }
@Test public void testToList() { assertTrue(UimaTypesUtils.toList((StringArray) null).isEmpty()); assertTrue(UimaTypesUtils.toList((FSArray) null).isEmpty()); FSArray array = new FSArray(jCas, 2); assertEquals(2, UimaTypesUtils.toList(array).size()); array.set(0, new Entity(jCas)); array.set(1, new Entity(jCas)); List<Entity> list = UimaTypesUtils.toList(array); assertEquals(2, list.size()); assertSame(array.get(0), list.get(0)); assertSame(array.get(0), list.get(0)); }