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


Java List.contains方法代码示例

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


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

示例1: isDeprecatedOverrideIgnorable

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private boolean isDeprecatedOverrideIgnorable(MethodSymbol m, ClassSymbol origin) {
    // If the method, m, is defined in an interface, then ignore the issue if the method
    // is only inherited via a supertype and also implemented in the supertype,
    // because in that case, we will rediscover the issue when examining the method
    // in the supertype.
    // If the method, m, is not defined in an interface, then the only time we need to
    // address the issue is when the method is the supertype implemementation: any other
    // case, we will have dealt with when examining the supertype classes
    ClassSymbol mc = m.enclClass();
    Type st = types.supertype(origin.type);
    if (st.tag != CLASS)
        return true;
    MethodSymbol stimpl = m.implementation((ClassSymbol)st.tsym, types, false);

    if (mc != null && ((mc.flags() & INTERFACE) != 0)) {
        List<Type> intfs = types.interfaces(origin.type);
        return (intfs.contains(mc.type) ? false : (stimpl != null));
    }
    else
        return (stimpl != m);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:22,代码来源:Check.java

示例2: isDeprecatedOverrideIgnorable

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private boolean isDeprecatedOverrideIgnorable(MethodSymbol m, ClassSymbol origin) {
    // If the method, m, is defined in an interface, then ignore the issue if the method
    // is only inherited via a supertype and also implemented in the supertype,
    // because in that case, we will rediscover the issue when examining the method
    // in the supertype.
    // If the method, m, is not defined in an interface, then the only time we need to
    // address the issue is when the method is the supertype implemementation: any other
    // case, we will have dealt with when examining the supertype classes
    ClassSymbol mc = m.enclClass();
    Type st = types.supertype(origin.type);
    if (!st.hasTag(CLASS))
        return true;
    MethodSymbol stimpl = m.implementation((ClassSymbol)st.tsym, types, false);

    if (mc != null && ((mc.flags() & INTERFACE) != 0)) {
        List<Type> intfs = types.interfaces(origin.type);
        return (intfs.contains(mc.type) ? false : (stimpl != null));
    }
    else
        return (stimpl != m);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Check.java

示例3: getAnalyzerModes

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * This method is used to parse the {@code find} option.
 * Possible modes are separated by colon; a mode can be excluded by
 * prepending '-' to its name. Finally, the special mode 'all' can be used to
 * add all modes to the resulting enum.
 */
static EnumSet<AnalyzerMode> getAnalyzerModes(String opt, Source source) {
    if (opt == null) {
        return EnumSet.noneOf(AnalyzerMode.class);
    }
    List<String> modes = List.from(opt.split(","));
    EnumSet<AnalyzerMode> res = EnumSet.noneOf(AnalyzerMode.class);
    if (modes.contains("all")) {
        res = EnumSet.allOf(AnalyzerMode.class);
    }
    for (AnalyzerMode mode : values()) {
        if (modes.contains(mode.opt)) {
            res.add(mode);
        } else if (modes.contains("-" + mode.opt) || !mode.sourceFilter.test(source)) {
            res.remove(mode);
        }
    }
    return res;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:Analyzer.java

示例4: contains

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public boolean contains(RelativePath name) {
    RelativeDirectory dirname = name.dirname();
    String basename = name.basename();
    if (basename.length() == 0)
        return false;
    List<String> list = map.get(dirname);
    return (list != null && list.contains(basename));
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:9,代码来源:ZipArchive.java

示例5: checkNonCyclic1

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private void checkNonCyclic1(DiagnosticPosition pos, Type t, List<TypeVar> seen) {
    final TypeVar tv;
    if  (t.tag == TYPEVAR && (t.tsym.flags() & UNATTRIBUTED) != 0)
        return;
    if (seen.contains(t)) {
        tv = (TypeVar)t;
        tv.bound = types.createErrorType(t);
        log.error(pos, "cyclic.inheritance", t);
    } else if (t.tag == TYPEVAR) {
        tv = (TypeVar)t;
        seen = seen.prepend(tv);
        for (Type b : types.getBounds(tv))
            checkNonCyclic1(pos, b, seen);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:16,代码来源:Check.java

示例6: searchSubPackage

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:JavadocTool.java

示例7: checkNonCyclic1

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private void checkNonCyclic1(DiagnosticPosition pos, Type t, List<TypeVar> seen) {
    final TypeVar tv;
    if  (t.hasTag(TYPEVAR) && (t.tsym.flags() & UNATTRIBUTED) != 0)
        return;
    if (seen.contains(t)) {
        tv = (TypeVar)t.unannotatedType();
        tv.bound = types.createErrorType(t);
        log.error(pos, "cyclic.inheritance", t);
    } else if (t.hasTag(TYPEVAR)) {
        tv = (TypeVar)t.unannotatedType();
        seen = seen.prepend(tv);
        for (Type b : types.getBounds(tv))
            checkNonCyclic1(pos, b, seen);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:Check.java

示例8: checkNonCyclic1

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private void checkNonCyclic1(DiagnosticPosition pos, Type t, List<TypeVar> seen) {
    final TypeVar tv;
    if  (t.hasTag(TYPEVAR) && (t.tsym.flags() & UNATTRIBUTED) != 0)
        return;
    if (seen.contains(t)) {
        tv = (TypeVar)t;
        tv.bound = types.createErrorType(t);
        log.error(pos, Errors.CyclicInheritance(t));
    } else if (t.hasTag(TYPEVAR)) {
        tv = (TypeVar)t;
        seen = seen.prepend(tv);
        for (Type b : types.getBounds(tv))
            checkNonCyclic1(pos, b, seen);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:Check.java

示例9: test_contains_Object

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
void test_contains_Object() {
    System.err.println("test contains(Object)");
    for (Map.Entry<java.util.List<String>,List<String>> e: examples.entrySet()) {
        java.util.List<String> ref = e.getKey();
        List<String> l = e.getValue();
        boolean expect = ref.contains("1");
        boolean found = l.contains("1");
        if (expect != found)
            throw new AssertionError();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TList.java

示例10: test_remove_Object

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
void test_remove_Object() {
    System.err.println("test remove(Object)");
    for (List<String> l: examples.values()) {
        boolean hasX = l.contains("X");
        try {
            l.remove("X");
            if (hasX)
                throw new AssertionError();
        } catch (UnsupportedOperationException ex) {
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TList.java


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