public FormIndex[] getCompoundIndices(FormIndex container) { //ArrayLists are a no-go for J2ME List <FormIndex> indices = new List <FormIndex>(); FormIndex walker = incrementIndex(container); while (FormIndex.isSubElement(container, walker)) { if (isIndexRelevant(walker)) { indices.Add(walker); } walker = incrementIndex(walker); } FormIndex[] array = new FormIndex[indices.Count]; for (int i = 0; i < indices.Count; ++i) { array[i] = indices[i]; } return(array); }