java.util.AbstractList

Here are the examples of the java api class java.util.AbstractList taken from open source projects.

1. ListIterationBenchmark#setUp()

Project: caliper
Source File: ListIterationBenchmark.java
View license
@BeforeExperiment
void setUp() {
    array = new Object[length];
    for (int i = 0; i < length; i++) {
        array[i] = new Object();
    }
    list = new AbstractList<Object>() {

        @Override
        public int size() {
            return length;
        }

        @Override
        public Object get(int i) {
            return array[i];
        }
    };
}

2. AbstractSectionParm#groupNamesToArray()

Project: uima-uimaj
Source File: AbstractSectionParm.java
View license
protected String[] groupNamesToArray(String names) {
    if (names.equals(NOT_IN_ANY_GROUP))
        return new String[] { names };
    AbstractList items = new ArrayList();
    int start = 0;
    int end;
    while (start < names.length() && (names.charAt(start) == ' ')) start++;
    for (; start < names.length(); ) {
        end = names.indexOf(' ', start);
        if (end == -1) {
            items.add(names.substring(start));
            break;
        }
        items.add(names.substring(start, end));
        start = end;
        while (start < names.length() && names.charAt(start) == ' ') start++;
    }
    return (String[]) items.toArray(stringArray0);
}

3. AbstractSectionParm#getSettingsGroups()

Project: uima-uimaj
Source File: AbstractSectionParm.java
View license
/**
   * get set of settings group from settingsTree that correspond to parmsection group
   * 
   * @param group
   * @return set of settings group from settingsTree that correspond to parm-section group
   */
protected TreeItem[] getSettingsGroups(TreeItem group) {
    if (null == settingsTree)
        return null;
    if (isNOT_IN_ANY_GROUP(group))
        return new TreeItem[] { settingsTree.getItems()[0] };
    AbstractList results = new ArrayList();
    String[] groupNamesArray = groupNamesToArray(getName(group.getText()));
    TreeItem[] items = settingsTree.getItems();
    if (groupNamesArray.length == 1 && groupNamesArray[0].equals(COMMON_GROUP)) {
        // add parm to all groups except <Not in any group>
        TreeItem[] result = new TreeItem[items.length - 1];
        System.arraycopy(items, 1, result, 0, result.length);
        return result;
    }
    for (int itemIndex = 0; itemIndex < items.length; itemIndex++) {
        String name = getName(items[itemIndex].getText());
        for (int i = 0; i < groupNamesArray.length; i++) {
            if (name.equals(groupNamesArray[i]))
                results.add(items[itemIndex]);
        }
    }
    return (TreeItem[]) results.toArray(treeItemArray0);
}