当前位置: 首页>>代码示例>>Java>>正文


Java List.equals方法代码示例

本文整理汇总了Java中java.util.List.equals方法的典型用法代码示例。如果您正苦于以下问题:Java List.equals方法的具体用法?Java List.equals怎么用?Java List.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.List的用法示例。


在下文中一共展示了List.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isMethodInRequestOptions

import java.util.List; //导入方法依赖的package包/类
private boolean isMethodInRequestOptions(ExecutableElement toFind) {
  // toFind is a method in a GlideExtension whose first argument is a BaseRequestOptions<?> type.
  // Since we're comparing against methods in BaseRequestOptions itself, we need to drop that
  // first type.
  List<String> toFindParameterNames = getComparableParameterNames(toFind, true /*skipFirst*/);
  String toFindSimpleName = toFind.getSimpleName().toString();
  for (Element element : requestOptionsType.getEnclosedElements()) {
    if (element.getKind() != ElementKind.METHOD) {
      continue;
    }
    ExecutableElement inBase = (ExecutableElement) element;
    if (toFindSimpleName.equals(inBase.getSimpleName().toString())) {
      List<String> parameterNamesInBase =
          getComparableParameterNames(inBase, false /*skipFirst*/);
      if (parameterNamesInBase.equals(toFindParameterNames)) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:RequestOptionsGenerator.java

示例2: test2

import java.util.List; //导入方法依赖的package包/类
/**
 * Verifies that SystemFlavorMap is not affected by modification of
 * the Lists returned from getNativesForFlavor() and
 * getFlavorsForNative().
 */
public static void test2() {
    DataFlavor df = new DataFlavor("text/plain-test2", null);
    String nat = "native2";
    DataFlavor extraDf = new DataFlavor("text/test", null);

    List<String> natives = fm.getNativesForFlavor(df);
    natives.add("Should not be here");
    java.util.List nativesNew = fm.getNativesForFlavor(df);
    if (natives.equals(nativesNew)) {
        System.err.println("orig=" + natives);
        System.err.println("new=" + nativesNew);
        throw new RuntimeException("Test failed");
    }

    List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
    flavors.add(extraDf);
    java.util.List flavorsNew = fm.getFlavorsForNative(nat);
    if (flavors.equals(flavorsNew)) {
        System.err.println("orig=" + flavors);
        System.err.println("new=" + flavorsNew);
        throw new RuntimeException("Test failed");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:MappingGenerationTest.java

示例3: testUseOnlyOneProcessor

import java.util.List; //导入方法依赖的package包/类
@Test
public void testUseOnlyOneProcessor(Path base) throws Exception {
    initialization(base);
    List<String> log = new JavacTask(tb)
            .options("--processor-module-path", processorCompiledModules.toString(),
                    "-Xplugin:simpleplugin1")
            .outdir(classes)
            .sources(testClass)
            .run()
            .writeAll()
            .getOutputLines(Task.OutputKind.STDOUT);
    if (!log.equals(Arrays.asList("simpleplugin1 started for event COMPILATION",
                                  "simpleplugin1 finished for event COMPILATION"))) {
        throw new AssertionError("Unexpected output: " + log);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:PluginsInModulesTest.java

示例4: checkDiags

import java.util.List; //导入方法依赖的package包/类
void checkDiags(String msg, List<Diagnostic<? extends JavaFileObject>> diags, List<String> expectDiagCodes) {
    System.err.print(msg);
    if (diags.isEmpty())
        System.err.println(" OK");
    else {
        System.err.println();
        System.err.println(diags);
    }

    List<String> foundDiagCodes = new ArrayList<String>();
    for (Diagnostic<? extends JavaFileObject> d: diags)
        foundDiagCodes.add(d.getCode());

    if (!foundDiagCodes.equals(expectDiagCodes)) {
        System.err.println("Found diag codes:    " + foundDiagCodes);
        System.err.println("Expected diag codes: " + expectDiagCodes);
        error("expected diagnostics not found");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:ProfileOptionTest.java

示例5: compareValues

import java.util.List; //导入方法依赖的package包/类
/**
 * Compares two values, paying attention to the order of the elements.
 * @return true if the values are different
 */
// TODO improve efficiency for the array case?
@Override
@SuppressWarnings("unchecked")
protected boolean compareValues(Object previous, Object value)
{
  int prevSize = __getSize(previous);
  int newSize = __getSize(value);

  // If the sizes are different, no need to bother with further work
  if (prevSize != newSize)
    return true;

  // If the sizes are the same, and they're empty, we're also done.
  if (prevSize == 0)
    return false;

  List<Object> prevList = (previous instanceof List)
                    ? (List<Object>) previous : __toList(previous);
  List<Object> newList = (value instanceof List)
                    ? (List<Object>) value : __toList(value);

  // Since List has explicit rules about how equals() works, we
  // can just use that method.
  return !prevList.equals(newList);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:30,代码来源:UIXSelectOrderTemplate.java

示例6: extendStringToMatchByOneCharacter

import java.util.List; //导入方法依赖的package包/类
private void extendStringToMatchByOneCharacter(final char c) {
    final List<Head> newHeads = listForLocalUseage;
    newHeads.clear();
    List<Head> lastAddedHeads = null;
    for(final Head head : heads) {
        final List<Head> headsToAdd = head.getNextHeads(c);
        // Why the next performance optimization isn't wrong:
        // Some times two heads return the very same list.
        // We save future effort if we don't add these heads again.
        // This is the case with the heads "a" and "*" of "a*b" which
        // both can return the list ["*","b"]
        if(!headsToAdd.equals(lastAddedHeads)) {
            newHeads.addAll(headsToAdd);
            lastAddedHeads = headsToAdd;
        }
    }
    listForLocalUseage = heads;
    heads = newHeads;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:20,代码来源:FileNameMatcher.java

示例7: doArgumentCheck

import java.util.List; //导入方法依赖的package包/类
void doArgumentCheck(String inArgs, String... expArgs) {
    Map<String, String> env = new HashMap<>();
    env.put(JLDEBUG_KEY, "true");
    TestResult tr = doExec(env, javaCmd, inArgs);
    System.out.println(tr);
    int sindex = tr.testOutput.indexOf("Command line args:");
    if (sindex < 0) {
        System.out.println(tr);
        throw new RuntimeException("Error: no output");
    }
    sindex++; // skip over the tag
    List<String> gotList = new ArrayList<>();
    for (String x : tr.testOutput.subList(sindex, sindex + expArgs.length)) {
        String a[] = x.split("=");
        gotList.add(a[a.length - 1].trim());
    }
    List<String> expList = Arrays.asList(expArgs);
    if (!gotList.equals(expList)) {
        System.out.println(tr);
        System.out.println("Expected args:");
        System.out.println(expList);
        System.out.println("Obtained args:");
        System.out.println(gotList);
        throw new RuntimeException("Error: args do not match");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:Arrrghs.java

示例8: testUnsafeUnnamed

import java.util.List; //导入方法依赖的package包/类
@Test
public void testUnsafeUnnamed(Path base) throws IOException {
    Path src = base.resolve("src");
    tb.writeJavaFiles(src,
                      "package test; public class Test { sun.misc.Unsafe unsafe; } ");
    Path classes = base.resolve("classes");
    tb.createDirectories(classes);

    List<String> log;
    List<String> expected = Arrays.asList(
            "Test.java:1:43: compiler.warn.sun.proprietary: sun.misc.Unsafe",
            "1 warning"
    );

    log = new JavacTask(tb)
            .options("-XDrawDiagnostics")
            .outdir(classes)
            .files(tb.findJavaFiles(src))
            .run(Expect.SUCCESS)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);

    if (!expected.equals(log)) {
        throw new AssertionError("Unexpected output: " + log);
    }

    log = new JavacTask(tb)
            .options("-XDrawDiagnostics",
                     "--release", Target.DEFAULT.multiReleaseValue())
            .outdir(classes)
            .files(tb.findJavaFiles(src))
            .run(Expect.SUCCESS)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);

    if (!expected.equals(log)) {
        throw new AssertionError("Unexpected output: " + log);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:ReleaseOptionUnsupported.java

示例9: rewriteChildren

import java.util.List; //导入方法依赖的package包/类
protected final ModifiersTree rewriteChildren(ModifiersTree tree) {
List<? extends AnnotationTree> annotations = translateStable(tree.getAnnotations());
if (!annotations.equals(tree.getAnnotations())) {
    ModifiersTree n = make.Modifiers(tree, annotations);
           model.setType(n, model.getType(tree));
    copyCommentTo(tree,n);
           copyPosTo(tree,n);
    tree = n;
}
return tree;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ImmutableTreeTranslator.java

示例10: testInaccessibleUnnamedModule

import java.util.List; //导入方法依赖的package包/类
public void testInaccessibleUnnamedModule(Path base) throws Exception {
    Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }");

    Path moduleSrc = base.resolve("module-src");
    Path m1x = moduleSrc.resolve("m1x");

    Path classes = base.resolve("classes");

    Files.createDirectories(classes);

    tb.writeJavaFiles(m1x,
                      "module m1x { }",
                      "package test; public class Test { api.Api api; api.Api.Foo api; }");

    List<String> log = new JavacTask(tb)
            .options("-classpath", jar.toString(),
                     "-XDrawDiagnostics")
            .outdir(classes)
            .files(findJavaFiles(moduleSrc))
            .run(Task.Expect.FAIL)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);

    List<String> expected = Arrays.asList(
            "Test.java:1:38: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
            "Test.java:1:51: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
            "2 errors");

    if (!expected.equals(log))
        throw new Exception("expected output not found; actual: " + log);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:ConvenientAccessErrorsTest.java

示例11: processInstanceLists

import java.util.List; //导入方法依赖的package包/类
private void processInstanceLists(JSONObject instanceLists){
  try {
    joinedInstances = JsonUtil.getStringListFromJsonArray(instanceLists.
        getJSONArray(JOINED_LIST_KEY));

    publicInstances = JsonUtil.getStringListFromJsonArray(instanceLists.
        getJSONArray(PUBLIC_LIST_KEY));

    List<String> receivedInstancesInvited = JsonUtil.getStringListFromJsonArray(instanceLists.
        getJSONArray(INVITED_LIST_KEY));

    if (!receivedInstancesInvited.equals(InvitedInstances())) {
      List<String> oldList = invitedInstances;
      invitedInstances = receivedInstancesInvited;
      List<String> newInvites = new ArrayList<String>(receivedInstancesInvited);
      newInvites.removeAll(oldList);

      for (final String instanceInvited : newInvites) {
        Invited(instanceInvited);
      }
    }

  } catch (JSONException e) {
    Log.w(LOG_TAG, e);
    Info("Instance lists failed to parse.");
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:28,代码来源:GameClient.java

示例12: updateExtraWizardPanels

import java.util.List; //导入方法依赖的package包/类
private void updateExtraWizardPanels() {
    List<WizardDescriptor.Panel<WizardDescriptor>> l = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
    if (getCurrent() == workspacePanel) {
        numberOfPanels = workspacePanel.isWorkspaceChosen() ? 2 : 1;
    }
    if (getCurrent() != projectPanel) {
        return;
    }
    Set<String> alreadyIncluded = new HashSet<String>();
    List<String> panelProviders = new ArrayList<String>();
    for (EclipseProject ep : getProjects()) {
        if (!ep.isImportSupported()) {
            continue;
        }
        if (alreadyIncluded.contains(ep.getProjectTypeFactory().getClass().getName())) {
            continue;
        } else {
            alreadyIncluded.add(ep.getProjectTypeFactory().getClass().getName());
        }
        l.addAll(ep.getProjectTypeFactory().getAdditionalImportWizardPanels());
        panelProviders.add(ep.getProjectTypeFactory().getClass().getName());
    }
    if (panelProviders.equals(currentPanelProviders)) {
        return;
    } else {
        currentPanelProviders = panelProviders;
    }
    extraPanels = l;
    numberOfPanels = 2 + l.size();
    int index = 2;
    for (WizardDescriptor.Panel p : l) {
        JComponent comp = (JComponent)p.getComponent();
        comp.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX,  // NOI18N
                new Integer(index));
        index++;
        comp.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, getWizardPanelName(l));
    }
    ((JComponent)projectPanel.getComponent()).putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, getWizardPanelName(l));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:EclipseWizardIterator.java

示例13: patchCreatesNewFileThatAlreadyExists

import java.util.List; //导入方法依赖的package包/类
private boolean patchCreatesNewFileThatAlreadyExists(SinglePatch patch, List<String> originalFile) throws PatchException {
    if (patch.hunks.length != 1) {
        return false;
    }
    Hunk hunk = patch.hunks[0];
    if (hunk.baseStart != 0 || hunk.baseCount != 0 || hunk.modifiedStart
            != 1 || hunk.modifiedCount != originalFile.size()) {
        return false;
    }

    List<String> target = new ArrayList<>(hunk.modifiedCount);
    applyHunk(target, hunk);
    return target.equals(originalFile);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:PatchFile.java

示例14: checkArgumentParsing

import java.util.List; //导入方法依赖的package包/类
void checkArgumentParsing(String inArgs, String... expArgs) throws IOException {
    List<String> scratchpad = new ArrayList<>();
    scratchpad.add("set " + JLDEBUG_KEY + "=true");
    // GAK, -version needs to be added so that windows can flush its stderr
    // exiting the process prematurely can terminate the stderr.
    scratchpad.add(javaCmd + " -version " + inArgs);
    File batFile = new File("atest.bat");
    createAFile(batFile, scratchpad);

    TestResult tr = doExec(batFile.getName());

    ArrayList<String> expList = new ArrayList<>();
    expList.add(javaCmd);
    expList.add("-version");
    expList.addAll(Arrays.asList(expArgs));

    List<String> gotList = new ArrayList<>();
    for (String x : tr.testOutput) {
        Matcher m = ArgPattern.matcher(x);
        if (m.matches()) {
            String a[] = x.split("=");
            gotList.add(a[a.length - 1].trim());
        }
    }
    if (!gotList.equals(expList)) {
        System.out.println(tr);
        System.out.println("Expected args:");
        System.out.println(expList);
        System.out.println("Obtained args:");
        System.out.println(gotList);
        throw new RuntimeException("Error: args do not match");
    }
    System.out.println("\'" + inArgs + "\'" + " - Test passed");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:35,代码来源:Arrrghs.java

示例15: dropArgumentsToMatch

import java.util.List; //导入方法依赖的package包/类
private static MethodHandle dropArgumentsToMatch(MethodHandle target, int skip, List<Class<?>> newTypes, int pos,
                                  boolean nullOnFailure) {
    newTypes = copyTypes(newTypes.toArray());
    List<Class<?>> oldTypes = target.type().parameterList();
    int match = oldTypes.size();
    if (skip != 0) {
        if (skip < 0 || skip > match) {
            throw newIllegalArgumentException("illegal skip", skip, target);
        }
        oldTypes = oldTypes.subList(skip, match);
        match -= skip;
    }
    List<Class<?>> addTypes = newTypes;
    int add = addTypes.size();
    if (pos != 0) {
        if (pos < 0 || pos > add) {
            throw newIllegalArgumentException("illegal pos", pos, newTypes);
        }
        addTypes = addTypes.subList(pos, add);
        add -= pos;
        assert(addTypes.size() == add);
    }
    // Do not add types which already match the existing arguments.
    if (match > add || !oldTypes.equals(addTypes.subList(0, match))) {
        if (nullOnFailure) {
            return null;
        }
        throw newIllegalArgumentException("argument lists do not match", oldTypes, newTypes);
    }
    addTypes = addTypes.subList(match, add);
    add -= match;
    assert(addTypes.size() == add);
    // newTypes:     (   P*[pos], M*[match], A*[add] )
    // target: ( S*[skip],        M*[match]  )
    MethodHandle adapter = target;
    if (add > 0) {
        adapter = dropArguments0(adapter, skip+ match, addTypes);
    }
    // adapter: (S*[skip],        M*[match], A*[add] )
    if (pos > 0) {
        adapter = dropArguments0(adapter, skip, newTypes.subList(0, pos));
    }
    // adapter: (S*[skip], P*[pos], M*[match], A*[add] )
    return adapter;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:46,代码来源:MethodHandles.java


注:本文中的java.util.List.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。