Java Examples for java.util.List

The following java examples will help you to understand the usage of java.util.List. These source code samples are taken from different open source projects.

Example 1
Project: extFM-Tooling-master  File: MtextOutlinePageActionProvider.java View source code
public java.util.List<org.eclipse.jface.action.IAction> getActions(org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextOutlinePageTreeViewer treeViewer) {
    // To add custom actions to the outline view, set the
    // 'overrideOutlinePageActionProvider' option to <code>false</code> and modify
    // this method.
    java.util.List<org.eclipse.jface.action.IAction> defaultActions = new java.util.ArrayList<org.eclipse.jface.action.IAction>();
    defaultActions.add(new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextOutlinePageLinkWithEditorAction(treeViewer));
    defaultActions.add(new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextOutlinePageCollapseAllAction(treeViewer));
    defaultActions.add(new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextOutlinePageExpandAllAction(treeViewer));
    defaultActions.add(new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextOutlinePageAutoExpandAction(treeViewer));
    defaultActions.add(new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextOutlinePageLexicalSortingAction(treeViewer));
    defaultActions.add(new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextOutlinePageTypeSortingAction(treeViewer));
    return defaultActions;
}
Example 2
Project: rascal-master  File: Declarator.java View source code
@Override
protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) {
    if (getLocation().getBeginLine() == $line) {
        $result.add(this);
    }
    ISourceLocation $l;
    $l = type.getLocation();
    if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
        type.addForLineNumber($line, $result);
    }
    if ($l.getBeginLine() > $line) {
        return;
    }
    for (AbstractAST $elem : variables) {
        $l = $elem.getLocation();
        if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
            $elem.addForLineNumber($line, $result);
        }
        if ($l.getBeginLine() > $line) {
            return;
        }
    }
}
Example 3
Project: openjdk-master  File: T8064464.java View source code
void m(List<Integer> lx) {
    //ok --> f(int)
    Integer i1 = f(!lx.isEmpty() ? 0 : lx.get(0));
    //ok --> f(int)
    Integer i2 = f(!lx.isEmpty() ? lx.get(0) : 0);
    // ambiguous
    f(!lx.isEmpty() ? id() : 0);
    // ambiguous
    f(!lx.isEmpty() ? 0 : id());
}
Example 4
Project: ManagedRuntimeInitiative-master  File: TList.java View source code
void run() {
    examples = new LinkedHashMap<java.util.List<String>, List<String>>();
    for (String[] values : data) examples.put(Arrays.asList(values), createList(values));
    // 6351336: com.sun.tools.javac.util.List shouldn't extend java.util.AbstractList
    test_AbstractList();
    // general unit tests for java.util.List methods, including...
    // 6389198: com.sun.tools.javac.util.List.equals() violates java.util.List.equals() contract
    test_add_E();
    test_add_int_E();
    test_addAll_Collection();
    test_addAll_int_Collection();
    test_clear();
    test_contains_Object();
    test_contains_All();
    test_equals_Object();
    test_get_int();
    test_hashCode();
    test_indexOf_Object();
    test_isEmpty();
    test_iterator();
    test_lastIndexOf_Object();
    test_listIterator();
    test_listIterator_int();
    test_remove_int();
    test_remove_Object();
    test_removeAll_Collection();
    test_retainAll_Collection();
    test_set_int_E();
    test_size();
    test_subList_int_int();
    test_toArray();
    test_toArray_TArray();
    // tests for additional methods
    test_prependList_List();
    test_reverse();
}
Example 5
Project: teiid-designer-master  File: TransientRelationTrackerImpl.java View source code
/**
     * @See org.teiid.designer.modelgenerator.RelationTracker#recordGeneratedFrom(java.util.List, java.util.List)
     */
@Override
public void recordGeneratedFrom(final List inputs, final List outputs, final List problems) {
    /*
         * the top two objects in each of the lists will be 'directly' related to one another.
         */
    if (inputs.size() > 0 && outputs.size() > 0) {
        doMapping((EObject) inputs.get(0), (EObject) outputs.get(0));
    }
}
Example 6
Project: aws-sdk-android-master  File: DescribeRegionsRequestMarshaller.java View source code
public Request<DescribeRegionsRequest> marshall(DescribeRegionsRequest describeRegionsRequest) {
    if (describeRegionsRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }
    Request<DescribeRegionsRequest> request = new DefaultRequest<DescribeRegionsRequest>(describeRegionsRequest, "AmazonEC2");
    request.addParameter("Action", "DescribeRegions");
    request.addParameter("Version", "2015-10-01");
    java.util.List<String> regionNamesList = describeRegionsRequest.getRegionNames();
    int regionNamesListIndex = 1;
    for (String regionNamesListValue : regionNamesList) {
        if (regionNamesListValue != null) {
            request.addParameter("RegionName." + regionNamesListIndex, StringUtils.fromString(regionNamesListValue));
        }
        regionNamesListIndex++;
    }
    java.util.List<Filter> filtersList = describeRegionsRequest.getFilters();
    int filtersListIndex = 1;
    for (Filter filtersListValue : filtersList) {
        Filter filterMember = filtersListValue;
        if (filterMember != null) {
            if (filterMember.getName() != null) {
                request.addParameter("Filter." + filtersListIndex + ".Name", StringUtils.fromString(filterMember.getName()));
            }
            java.util.List<String> valuesList = filterMember.getValues();
            int valuesListIndex = 1;
            for (String valuesListValue : valuesList) {
                if (valuesListValue != null) {
                    request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex, StringUtils.fromString(valuesListValue));
                }
                valuesListIndex++;
            }
        }
        filtersListIndex++;
    }
    return request;
}
Example 7
Project: eclipselink.runtime-master  File: Choice.java View source code
public void setOrderedElements(java.util.List newElements) {
    orderedElements = newElements;
    for (int i = 0; i < newElements.size(); i++) {
        Object next = newElements.get(i);
        if (next instanceof Element) {
            getElements().add(next);
        }
    }
}
Example 8
Project: xmind-master  File: CheckOpenFilesProcess.java View source code
/*
     * (non-Javadoc)
     *
     * @see
     * org.xmind.cathy.internal.jobs.OpenFilesJob#filterFilesToOpen(java.util
     * .List, org.eclipse.core.runtime.IProgressMonitor)
     */
@Override
protected void filterFilesToOpen(List<String> filesToOpen) {
    Log opening = Log.get(Log.OPENING);
    if (opening.exists()) {
        String[] contents = opening.getContents();
        for (String line : contents) {
            if (line.startsWith("xmind:") || new File(line).exists()) {
                //$NON-NLS-1$
                filesToOpen.add(line);
            }
        }
        opening.delete();
    }
}
Example 9
Project: dataverse-master  File: IndexUtil.java View source code
public static List<Long> findDvObjectIdsToProcessMod(List<Long> dvObjectIds, long mod, long which) {
    List<Long> subsetToProcess = new ArrayList<>();
    for (Long dvObjectId : dvObjectIds) {
        Long toAdd = dvObjectId % mod;
        if (toAdd.equals(which)) {
            subsetToProcess.add(dvObjectId);
        }
    }
    return subsetToProcess;
}
Example 10
Project: alien4cloud-master  File: AbstractLocationMatchFilterWithElector.java View source code
protected void filterWith(List<ILocationMatch> toFilter, ILocationMatchElector elector) {
    for (Iterator<ILocationMatch> it = toFilter.iterator(); it.hasNext(); ) {
        ILocationMatch locationMatch = it.next();
        if (!elector.isEligible(locationMatch)) {
            it.remove();
        }
    }
}
Example 11
Project: FallUML2013-master  File: FileUtil.java View source code
public static FileInfo getFile(String extension, List<FileInfo> fileList) {
    FileInfo info = null;
    for (int i = 0; i < fileList.size(); i++) {
        String extn = fileList.get(i).getFileName().substring(fileList.get(i).getFileName().lastIndexOf(".") + 1, fileList.get(i).getFileName().length());
        if (extn.equals(extension)) {
            info = fileList.get(i);
        }
    }
    return info;
}
Example 12
Project: dcache-master  File: NamedCellUtil.java View source code
public static String findDomainOfUniqueCell(Map<String, List<String>> domains, String cell) {
    String domain = "";
    for (Map.Entry<String, List<String>> entry : domains.entrySet()) {
        if (entry.getValue().contains(cell)) {
            domain = entry.getKey();
            break;
        }
    }
    return domain;
}
Example 13
Project: many-ql-master  File: ListenerHelper.java View source code
public Component getComponentByName(ID id, List<Component> componentList) {
    Component result = null;
    for (Component component : componentList) {
        if (id.getValue().equals(component.getName())) {
            result = component;
        }
    }
    return result;
}
Example 14
Project: airlift-master  File: ConfigDefaults.java View source code
static <T> ConfigDefaults<T> configDefaults(List<? extends ConfigDefaults<T>> configDefaults) {
    List<ConfigDefaults<T>> finalConfigDefaults = ImmutableList.copyOf(configDefaults);
    return  config -> {
        for (ConfigDefaults<T> configDefault : finalConfigDefaults) {
            configDefault.setDefaults(config);
        }
    };
}
Example 15
Project: hibernate-core-ogm-master  File: PersistentList.java View source code
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException {
    List deletes = new ArrayList();
    List sn = (List) getSnapshot();
    int end;
    if (sn.size() > list.size()) {
        for (int i = list.size(); i < sn.size(); i++) {
            deletes.add(indexIsFormula ? sn.get(i) : new Integer(i));
        }
        end = list.size();
    } else {
        end = sn.size();
    }
    for (int i = 0; i < end; i++) {
        if (list.get(i) == null && sn.get(i) != null) {
            deletes.add(indexIsFormula ? sn.get(i) : new Integer(i));
        }
    }
    return deletes.iterator();
}
Example 16
Project: clinic-softacad-master  File: PersistentList.java View source code
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException {
    List deletes = new ArrayList();
    List sn = (List) getSnapshot();
    int end;
    if (sn.size() > list.size()) {
        for (int i = list.size(); i < sn.size(); i++) {
            deletes.add(indexIsFormula ? sn.get(i) : i);
        }
        end = list.size();
    } else {
        end = sn.size();
    }
    for (int i = 0; i < end; i++) {
        if (list.get(i) == null && sn.get(i) != null) {
            deletes.add(indexIsFormula ? sn.get(i) : i);
        }
    }
    return deletes.iterator();
}
Example 17
Project: openmap-master  File: TTFeatureInfoHandler.java View source code
/*
    * (non-Javadoc)
    * 
    * @see
    * com.bbn.openmap.layer.vpf.VPFFeatureInfoHandler#updateInfoForOMGraphic
    * (com.bbn.openmap.omGraphics.OMGraphic,
    * com.bbn.openmap.layer.vpf.FeatureClassInfo, java.util.List)
    */
public void updateInfoForOMGraphic(OMGraphic omg, FeatureClassInfo fci, List<Object> fcirow) {
    DcwColumnInfo[] colInfo = fci.getColumnInfo();
    int columnCount = colInfo.length;
    StringBuffer sBuf = new StringBuffer("<html><body>");
    for (int i = 0; i < columnCount; i++) {
        sBuf.append("<b>" + colInfo[i].getColumnDescription() + ":</b> " + fcirow.get(i).toString() + "<br>");
    }
    sBuf.append("</body></html>");
    omg.putAttribute(OMGraphicConstants.TOOLTIP, sBuf.toString());
}
Example 18
Project: windowtester-master  File: InvalidEventStreamWriter.java View source code
/* (non-Javadoc)
     * @see com.windowtester.swt.event.writer.IEventStreamWriter#write(java.util.List)
     */
public void write(List events) {
    //        Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
    //        MessageDialog.openError(shell, Messages.getString("InvalidEventStreamWriter.STREAM_ERROR_TITLE"), _msg); //$NON-NLS-1$
    Tracer.trace(ICodeGenPluginTraceOptions.BASIC, "write called on invalid stream writer: " + _msg);
}
Example 19
Project: sosies-generator-master  File: ReplaceNewListQuery.java View source code
@Override
public Transformation query() throws QueryException {
    ReplaceNewListTransformation transformation = new ReplaceNewListTransformation();
    List<CtElement> newClasses = getInputProgram().getAllElement(CtConstructorCall.class);
    for (int i = 0; i < newClasses.size(); i++) {
        if (newClasses.get(i).getParent() instanceof CtLocalVariableImpl) {
            if (((CtLocalVariableImpl) newClasses.get(i).getParent()).getType().toString().startsWith("java.util.List")) {
                transformation.setTransplantationPoint((CtConstructorCall) newClasses.get(i));
                return transformation;
            }
        }
    }
    return null;
}
Example 20
Project: molgenis-master  File: FileExtensionUtils.java View source code
public static String findExtensionFromPossibilities(String fileName, Set<String> fileExtensions) {
    String name = fileName.toLowerCase();
    List<String> possibleExtensions = new ArrayList<String>();
    for (String extention : fileExtensions) {
        if (name.endsWith('.' + extention)) {
            possibleExtensions.add(extention);
        }
    }
    String longestExtension = null;
    for (String possibleExtension : possibleExtensions) {
        if (null == longestExtension) {
            longestExtension = possibleExtension;
            continue;
        } else {
            if (longestExtension.length() < possibleExtension.length())
                longestExtension = possibleExtension;
        }
    }
    return longestExtension;
}
Example 21
Project: hashtag-view-master  File: SortUtil.java View source code
public static <T> void symmetricSort(List<T> list) {
    @SuppressWarnings("unchecked") T[] array = (T[]) new Object[list.size()];
    for (int i = 0; i < list.size(); i++) {
        if (i % 2 == 0) {
            array[(list.size() - i) / 2 + (list.size() % 2 - 1)] = list.get(i);
        } else {
            array[(list.size() + i) / 2] = list.get(i);
        }
    }
    int j = 0;
    ListIterator<T> it = list.listIterator();
    while (it.hasNext()) {
        it.next();
        it.set(array[j++]);
    }
}
Example 22
Project: eclipse-commons-master  File: CollectionUtils.java View source code
/**
	 * Compares two lists lexicographically that contain comparable elements.
	 */
public static <T extends Comparable<? super T>> int compare(List<T> list1, List<T> list2) {
    int size1 = list1.size();
    int size2 = list2.size();
    int minSize = Math.min(size1, size2);
    for (int i = 0; i < minSize; i++) {
        int difference = list1.get(i).compareTo(list2.get(i));
        if (difference != 0) {
            return difference;
        }
    }
    if (size1 == size2) {
        return 0;
    } else {
        return size1 - size2;
    }
}
Example 23
Project: ehour-master  File: UserUtil.java View source code
public static List<User> filterUserOnRole(List<User> users, UserRole userRole) {
    List<User> validUsers = new ArrayList<>();
    // result of bad many-to-many mapping. should fix once..
    for (User user : users) {
        if (user.getUserRoles().contains(userRole)) {
            validUsers.add(user);
        }
    }
    return validUsers;
}
Example 24
Project: Yhb-2.0-master  File: PathHelper.java View source code
public static Path pathFromPoints(List<Point> points) {
    Path path = new Path();
    Point start = points.get(0);
    path.moveTo((float) start.x, (float) start.y);
    int l = points.size();
    for (int i = 1; i < l; i++) {
        Point point = points.get(i);
        path.lineTo((float) point.x, (float) point.y);
    }
    return path;
}
Example 25
Project: polly-master  File: AbstractLogOutput.java View source code
public String formatLogs(List<LogEntry> logs, LogFormatter formatter, FormatManager pollyFormat) {
    StringWriter string = new StringWriter();
    PrintWriter pw = new PrintWriter(string);
    Iterator<LogEntry> it = logs.iterator();
    while (it.hasNext()) {
        LogEntry log = it.next();
        pw.print(formatter.formatLog(log, pollyFormat));
        if (it.hasNext()) {
            pw.println();
        }
    }
    return string.toString();
}