當前位置: 首頁>>代碼示例>>Java>>正文


Java List.size方法代碼示例

本文整理匯總了Java中com.sun.tools.javac.util.List.size方法的典型用法代碼示例。如果您正苦於以下問題:Java List.size方法的具體用法?Java List.size怎麽用?Java List.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.tools.javac.util.List的用法示例。


在下文中一共展示了List.size方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test_retainAll_Collection

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_retainAll_Collection() {
    System.err.println("test retainAll(Collection)");
    for (List<String> l: examples.values()) {
        int l_size = l.size();
        for (java.util.List<String> arg: examples.keySet()) {
            try {
                boolean modified = l.retainAll(arg);
                if (modified)
                    throw new AssertionError();
            } catch (UnsupportedOperationException e) {
            }
            if (l.size() != l_size)
                throw new AssertionError();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:TList.java

示例2: test_addAll_Collection

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_addAll_Collection() {
    System.err.println("test addAll(Collection)");
    for (List<String> l: examples.values()) {
        int l_size = l.size();
        for (java.util.List<String> arg: examples.keySet()) {
            try {
                boolean modified = l.addAll(arg);
                if (modified)
                    throw new AssertionError();
            } catch (UnsupportedOperationException e) {
            }
            if (l.size() != l_size)
                throw new AssertionError();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:TList.java

示例3: test_addAll_int_Collection

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_addAll_int_Collection() {
    System.err.println("test addAll(int,Collection)");
    for (List<String> l: examples.values()) {
        int l_size = l.size();
        for (java.util.List<String> arg: examples.keySet()) {
            try {
                boolean modified = l.addAll(0, arg);
                if (modified)
                    throw new AssertionError();
            } catch (UnsupportedOperationException e) {
            }
            if (l.size() != l_size)
                throw new AssertionError();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:TList.java

示例4: test_removeAll_Collection

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_removeAll_Collection() {
    System.err.println("test removeAll(Collection)");
    for (List<String> l: examples.values()) {
        int l_size = l.size();
        for (java.util.List<String> arg: examples.keySet()) {
            try {
                boolean modified = l.removeAll(arg);
                if (modified)
                    throw new AssertionError();
            } catch (UnsupportedOperationException e) {
            }
            if (l.size() != l_size)
                throw new AssertionError();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:TList.java

示例5: test_size

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_size() {
    System.err.println("test size()");
    for (Map.Entry<java.util.List<String>,List<String>> e: examples.entrySet()) {
        java.util.List<String> ref = e.getKey();
        List<String> l = e.getValue();
        int  expect = ref.size();
        int found = l.size();
        if (expect != found)
            throw new AssertionError();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:TList.java

示例6: mayBeInstrument

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
@Override
protected boolean mayBeInstrument(@NotNull ReturnToInstrumentInfo info) {
    ReturnInstrumentationAstParent parent
            = info.getParent().accept(new MethodInstrumentationParentFinder(info), null);
    if (parent == null) {
        return false;
    }
    Optional<List<JCTree.JCStatement>> returnCheckOptional = buildReturnCheck(info);
    if (!returnCheckOptional.isPresent()) {
        return false;
    }
    List<JCTree.JCStatement> statements = parent.getStatements();
    for (int i = 0; i < statements.size(); i++) {
        JCTree.JCStatement statement = statements.get(i);
        if (statement == info.getReturnExpression()) {
            List<JCTree.JCStatement> newStatements = returnCheckOptional.get();
            for (int j = i + 1; j < statements.size(); j++) {
                newStatements = newStatements.append(statements.get(j));
            }
            for (int j = i - 1; j >= 0; j--) {
                newStatements = newStatements.prepend(statements.get(j));
            }
            parent.setStatements(newStatements);
            mayBeLogInstrumentation(info);
            return true;
        }
    }
    // When control flow reaches this place, that means that the AST parent doesn't contain any statments, so,
    // we just populate it with new instructions.
    parent.setStatements(returnCheckOptional.get());
    mayBeLogInstrumentation(info);
    return true;
}
 
開發者ID:denis-zhdanov,項目名稱:traute,代碼行數:34,代碼來源:MethodReturnInstrumentator.java

示例7: test

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test(List<String> list) {
    int n = list.size();
    if (n > 0)
        test(list, new String[0]);

    if (n > 1)
        test(list, new String[n - 1]);

    test(list, new String[n]);
    test(list, new String[n + 1]);
    test(list, new String[n + 5]);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:T6238612.java

示例8: catchClause

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/** CatchClause     = CATCH "(" FormalParameter ")" Block
 * TODO: the "FormalParameter" is not correct, it uses the special "catchTypes" rule below.
 */
protected JCCatch catchClause() {
    int pos = token.pos;
    accept(CATCH);
    accept(LPAREN);
    JCModifiers mods = optFinal(Flags.PARAMETER);
    List<JCExpression> catchTypes = catchTypes();
    JCExpression paramType = catchTypes.size() > 1 ?
            toP(F.at(catchTypes.head.getStartPosition()).TypeUnion(catchTypes)) :
            catchTypes.head;
    JCVariableDecl formal = variableDeclaratorId(mods, paramType);
    accept(RPAREN);
    JCBlock body = block();
    return F.at(pos).Catch(formal, body);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:JavacParser.java

示例9: test_reverse

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_reverse() {
    System.err.println("test reverse()");
    for (Map.Entry<java.util.List<String>,List<String>> e: examples.entrySet()) {
        java.util.List<String> ref = e.getKey();
        List<String> l = e.getValue();
        java.util.List<String> expect = reverse(ref);
        List<String> found = l.reverse();
        if (l.size() < 2 && found != l)  // reverse of empty or singleton list is itself
            throw new AssertionError();
        if (!equal(l, ref)) // orginal should be unchanged
            throw new AssertionError();
        if (!equal(expect, found))
            throw new AssertionError();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:TList.java

示例10: hasParameterTypes

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/** @see com.sun.tools.javadoc.ClassDocImpl */
private boolean hasParameterTypes(MethodSymbol method, List<Type> paramTypes) {
    if (paramTypes == null)
        return true;

    if (method.params().size() != paramTypes.size())
        return false;

    List<Type> methodParamTypes = types.erasureRecursive(method.asType()).getParameterTypes();

    return (Type.isErroneous(paramTypes))
        ? fuzzyMatch(paramTypes, methodParamTypes)
        : types.isSameTypes(paramTypes, methodParamTypes);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:15,代碼來源:JavacTrees.java

示例11: checkDefaultMethodClashes

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void checkDefaultMethodClashes(DiagnosticPosition pos, Type site) {
    DefaultMethodClashFilter dcf = new DefaultMethodClashFilter(site);
    for (Symbol m : types.membersClosure(site, false).getElements(dcf)) {
        Assert.check(m.kind == MTH);
        List<MethodSymbol> prov = types.interfaceCandidates(site, (MethodSymbol)m);
        if (prov.size() > 1) {
            ListBuffer<Symbol> abstracts = new ListBuffer<>();
            ListBuffer<Symbol> defaults = new ListBuffer<>();
            for (MethodSymbol provSym : prov) {
                if ((provSym.flags() & DEFAULT) != 0) {
                    defaults = defaults.append(provSym);
                } else if ((provSym.flags() & ABSTRACT) != 0) {
                    abstracts = abstracts.append(provSym);
                }
                if (defaults.nonEmpty() && defaults.size() + abstracts.size() >= 2) {
                    //strong semantics - issue an error if two sibling interfaces
                    //have two override-equivalent defaults - or if one is abstract
                    //and the other is default
                    String errKey;
                    Symbol s1 = defaults.first();
                    Symbol s2;
                    if (defaults.size() > 1) {
                        errKey = "types.incompatible.unrelated.defaults";
                        s2 = defaults.toList().tail.head;
                    } else {
                        errKey = "types.incompatible.abstract.default";
                        s2 = abstracts.first();
                    }
                    log.error(pos, errKey,
                            Kinds.kindName(site.tsym), site,
                            m.name, types.memberType(site, m).getParameterTypes(),
                            s1.location(), s2.location());
                    break;
                }
            }
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:39,代碼來源:Check.java

示例12: visitNewArray

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
public void visitNewArray(JCNewArray tree) {
    try {
        if (tree.elemtype != null) {
            print("new ");
            JCTree elem = tree.elemtype;
            printBaseElementType(elem);

            if (!tree.annotations.isEmpty()) {
                print(' ');
                printTypeAnnotations(tree.annotations);
            }
            if (tree.elems != null) {
                print("[]");
            }

            int i = 0;
            List<List<JCAnnotation>> da = tree.dimAnnotations;
            for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
                if (da.size() > i && !da.get(i).isEmpty()) {
                    print(' ');
                    printTypeAnnotations(da.get(i));
                }
                print("[");
                i++;
                printExpr(l.head);
                print("]");
            }
            printBrackets(elem);
        }
        if (tree.elems != null) {
            print("{");
            printExprs(tree.elems);
            print("}");
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:39,代碼來源:Pretty.java

示例13: checkDefaultMethodClashes

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void checkDefaultMethodClashes(DiagnosticPosition pos, Type site) {
    DefaultMethodClashFilter dcf = new DefaultMethodClashFilter(site);
    for (Symbol m : types.membersClosure(site, false).getSymbols(dcf)) {
        Assert.check(m.kind == MTH);
        List<MethodSymbol> prov = types.interfaceCandidates(site, (MethodSymbol)m);
        if (prov.size() > 1) {
            ListBuffer<Symbol> abstracts = new ListBuffer<>();
            ListBuffer<Symbol> defaults = new ListBuffer<>();
            for (MethodSymbol provSym : prov) {
                if ((provSym.flags() & DEFAULT) != 0) {
                    defaults = defaults.append(provSym);
                } else if ((provSym.flags() & ABSTRACT) != 0) {
                    abstracts = abstracts.append(provSym);
                }
                if (defaults.nonEmpty() && defaults.size() + abstracts.size() >= 2) {
                    //strong semantics - issue an error if two sibling interfaces
                    //have two override-equivalent defaults - or if one is abstract
                    //and the other is default
                    String errKey;
                    Symbol s1 = defaults.first();
                    Symbol s2;
                    if (defaults.size() > 1) {
                        errKey = "types.incompatible.unrelated.defaults";
                        s2 = defaults.toList().tail.head;
                    } else {
                        errKey = "types.incompatible.abstract.default";
                        s2 = abstracts.first();
                    }
                    log.error(pos, errKey,
                            Kinds.kindName(site.tsym), site,
                            m.name, types.memberType(site, m).getParameterTypes(),
                            s1.location(), s2.location());
                    break;
                }
            }
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:39,代碼來源:Check.java

示例14: isApplicable

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
boolean isApplicable(TypeConfiguration that) {
    List<TypeKind> actuals = that.typeKindList;
    List<TypeKind> formals = parameterTypes.typeKindList;
    if ((actuals.size() - formals.size()) < -1)
        return false; //not enough args
    for (TypeKind actual : actuals) {
        if (!actual.isSubtypeOf(formals.head))
            return false; //type mismatch
        formals = formals.tail.isEmpty() ?
            formals :
            formals.tail;
    }
    return true;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:T7042566.java

示例15: test_clear

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_clear() {
    System.err.println("test clear()");
    for (List<String> l: examples.values()) {
        int l_size = l.size();
        try {
            l.clear();
            if (l_size > 0)
                throw new AssertionError();
        } catch (UnsupportedOperationException e) {
        }
        if (l.size() != l_size)
            throw new AssertionError();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:TList.java


注:本文中的com.sun.tools.javac.util.List.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。