當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。