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


Java List.isEmpty方法代码示例

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


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

示例1: equals

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (!(obj instanceof MethodType))
        return false;
    MethodType m = (MethodType)obj;
    List<Type> args1 = argtypes;
    List<Type> args2 = m.argtypes;
    while (!args1.isEmpty() && !args2.isEmpty()) {
        if (!args1.head.equals(args2.head))
            return false;
        args1 = args1.tail;
        args2 = args2.tail;
    }
    if (!args1.isEmpty() || !args2.isEmpty())
        return false;
    return restype.equals(m.restype);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:19,代码来源:Type.java

示例2: translateArgs

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** Translate method argument list, casting each argument
 *  to its corresponding type in a list of target types.
 *  @param _args            The method argument list.
 *  @param parameters       The list of target types.
 *  @param varargsElement   The erasure of the varargs element type,
 *  or null if translating a non-varargs invocation
 */
<T extends JCTree> List<T> translateArgs(List<T> _args,
                                       List<Type> parameters,
                                       Type varargsElement) {
    if (parameters.isEmpty()) return _args;
    List<T> args = _args;
    while (parameters.tail.nonEmpty()) {
        args.head = translate(args.head, parameters.head);
        args = args.tail;
        parameters = parameters.tail;
    }
    Type parameter = parameters.head;
    Assert.check(varargsElement != null || args.length() == 1);
    if (varargsElement != null) {
        while (args.nonEmpty()) {
            args.head = translate(args.head, varargsElement);
            args = args.tail;
        }
    } else {
        args.head = translate(args.head, parameter);
    }
    return _args;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:TransTypes.java

示例3: switchBlockStatementGroup

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
protected JCCase switchBlockStatementGroup() {
    int pos = token.pos;
    List<JCStatement> stats;
    JCCase c;
    switch (token.kind) {
    case CASE:
        nextToken();
        JCExpression pat = parseExpression();
        accept(COLON);
        stats = blockStatements();
        c = F.at(pos).Case(pat, stats);
        if (stats.isEmpty())
            storeEnd(c, S.prevToken().endPos);
        return c;
    case DEFAULT:
        nextToken();
        accept(COLON);
        stats = blockStatements();
        c = F.at(pos).Case(null, stats);
        if (stats.isEmpty())
            storeEnd(c, S.prevToken().endPos);
        return c;
    }
    throw new AssertionError("should not reach here");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:JavacParser.java

示例4: intersect

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Intersect two closures
 */
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
    if (cl1 == cl2)
        return cl1;
    if (cl1.isEmpty() || cl2.isEmpty())
        return List.nil();
    if (cl1.head.tsym.precedes(cl2.head.tsym, this))
        return intersect(cl1.tail, cl2);
    if (cl2.head.tsym.precedes(cl1.head.tsym, this))
        return intersect(cl1, cl2.tail);
    if (isSameType(cl1.head, cl2.head))
        return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
    if (cl1.head.tsym == cl2.head.tsym &&
        cl1.head.tag == CLASS && cl2.head.tag == CLASS) {
        if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
            Type merge = merge(cl1.head,cl2.head);
            return intersect(cl1.tail, cl2.tail).prepend(merge);
        }
        if (cl1.head.isRaw() || cl2.head.isRaw())
            return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
    }
    return intersect(cl1.tail, cl2.tail);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:26,代码来源:Types.java

示例5: processAnnotations

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
@Override
public void processAnnotations(List<JCTree.JCCompilationUnit> roots, Collection<String> classnames) {
    if (roots.isEmpty()) {
        super.processAnnotations(roots, classnames);
    } else {
        setOrigin(roots.head.sourcefile.toUri().toString());
        try {
            super.processAnnotations(roots, classnames);
        } finally {
            setOrigin("");
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:NBJavaCompiler.java

示例6: comment

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Preserve classic semantics - if multiple javadocs are found on the token
 * the last one is returned
 */
public Comment comment(Comment.CommentStyle style) {
    List<Comment> comments = getComments(Comment.CommentStyle.JAVADOC);
    return comments.isEmpty() ?
            null :
            comments.head;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:Tokens.java

示例7: appendInitTypeAttributes

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public SymbolMetadata appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
    if (l.isEmpty()) {
        ; // no-op
    } else if (init_type_attributes.isEmpty()) {
        init_type_attributes = l;
    } else {
        init_type_attributes = init_type_attributes.appendList(l);
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:SymbolMetadata.java

示例8: makeOuterThis

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** Construct a tree that represents the outer instance
 *  <C.this>. Never pick the current `this'.
 *  @param pos           The source code position to be used for the tree.
 *  @param c             The qualifier class.
 */
JCExpression makeOuterThis(DiagnosticPosition pos, TypeSymbol c) {
    List<VarSymbol> ots = outerThisStack;
    if (ots.isEmpty()) {
        log.error(pos, "no.encl.instance.of.type.in.scope", c);
        Assert.error();
        return makeNull();
    }
    VarSymbol ot = ots.head;
    JCExpression tree = access(make.at(pos).Ident(ot));
    TypeSymbol otc = ot.type.tsym;
    while (otc != c) {
        do {
            ots = ots.tail;
            if (ots.isEmpty()) {
                log.error(pos,
                          "no.encl.instance.of.type.in.scope",
                          c);
                Assert.error(); // should have been caught in Attr
                return tree;
            }
            ot = ots.head;
        } while (ot.owner != otc);
        if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
            chk.earlyRefError(pos, c);
            Assert.error(); // should have been caught in Attr
            return makeNull();
        }
        tree = access(make.at(pos).Select(tree, ot));
        otc = ot.type.tsym;
    }
    return tree;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:38,代码来源:Lower.java

示例9: findTypeCompoundPosition

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private void findTypeCompoundPosition(JCTree tree, JCTree frame, List<Attribute.TypeCompound> annotations) {
    if (!annotations.isEmpty()) {
        final TypeAnnotationPosition p =
                resolveFrame(tree, frame, frames, currentLambda, 0, new ListBuffer<>());
        for (TypeCompound tc : annotations)
            tc.position = p;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:TypeAnnotations.java

示例10: appendClassInitTypeAttributes

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public SymbolMetadata appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
    if (l.isEmpty()) {
        // no-op
    } else if (clinit_type_attributes.isEmpty()) {
        clinit_type_attributes = l;
    } else {
        clinit_type_attributes = clinit_type_attributes.appendList(l);
    }
    return this;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:SymbolMetadata.java

示例11: JCLambda

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public JCLambda(List<JCVariableDecl> params,
                JCTree body) {
    this.params = params;
    this.body = body;
    if (params.isEmpty() ||
        params.head.vartype != null) {
        paramKind = ParameterKind.EXPLICIT;
    } else {
        paramKind = ParameterKind.IMPLICIT;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:JCTree.java

示例12: hasSameBounds

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Does t have the same bounds for quantified variables as s?
 */
boolean hasSameBounds(ForAll t, ForAll s) {
    List<Type> l1 = t.tvars;
    List<Type> l2 = s.tvars;
    while (l1.nonEmpty() && l2.nonEmpty() &&
           isSameType(l1.head.getUpperBound(),
                      subst(l2.head.getUpperBound(),
                            s.tvars,
                            t.tvars))) {
        l1 = l1.tail;
        l2 = l2.tail;
    }
    return l1.isEmpty() && l2.isEmpty();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:17,代码来源:Types.java

示例13: insert

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Insert a type in a closure
 */
public List<Type> insert(List<Type> cl, Type t) {
    if (cl.isEmpty() || t.tsym.precedes(cl.head.tsym, this)) {
        return cl.prepend(t);
    } else if (cl.head.tsym.precedes(t.tsym, this)) {
        return insert(cl.tail, t).prepend(cl.head);
    } else {
        return cl;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:13,代码来源:Types.java

示例14: union

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Form the union of two closures
 */
public List<Type> union(List<Type> cl1, List<Type> cl2) {
    if (cl1.isEmpty()) {
        return cl2;
    } else if (cl2.isEmpty()) {
        return cl1;
    } else if (cl1.head.tsym.precedes(cl2.head.tsym, this)) {
        return union(cl1.tail, cl2).prepend(cl1.head);
    } else if (cl2.head.tsym.precedes(cl1.head.tsym, this)) {
        return union(cl1, cl2.tail).prepend(cl2.head);
    } else {
        return union(cl1.tail, cl2.tail).prepend(cl1.head);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:17,代码来源:Types.java

示例15: makeOwnerThisN

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Similar to makeOwnerThis but will never pick "this".
 */
JCExpression makeOwnerThisN(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) {
    Symbol c = sym.owner;
    List<VarSymbol> ots = outerThisStack;
    if (ots.isEmpty()) {
        log.error(pos, "no.encl.instance.of.type.in.scope", c);
        Assert.error();
        return makeNull();
    }
    VarSymbol ot = ots.head;
    JCExpression tree = access(make.at(pos).Ident(ot));
    TypeSymbol otc = ot.type.tsym;
    while (!(preciseMatch ? sym.isMemberOf(otc, types) : otc.isSubClass(sym.owner, types))) {
        do {
            ots = ots.tail;
            if (ots.isEmpty()) {
                log.error(pos,
                    "no.encl.instance.of.type.in.scope",
                    c);
                Assert.error();
                return tree;
            }
            ot = ots.head;
        } while (ot.owner != otc);
        tree = access(make.at(pos).Select(tree, ot));
        otc = ot.type.tsym;
    }
    return tree;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:32,代码来源:Lower.java


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