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


Java List.reverse方法代码示例

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


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

示例1: enterClassFiles

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** Enter a set of generated class files. */
private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
    ClassReader reader = ClassReader.instance(context);
    Names names = Names.instance(context);
    List<ClassSymbol> list = List.nil();

    for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
        Name name = names.fromString(entry.getKey());
        JavaFileObject file = entry.getValue();
        if (file.getKind() != JavaFileObject.Kind.CLASS)
            throw new AssertionError(file);
        ClassSymbol cs;
        if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
            Name packageName = Convert.packagePart(name);
            PackageSymbol p = reader.enterPackage(packageName);
            if (p.package_info == null)
                p.package_info = reader.enterClass(Convert.shortName(name), p);
            cs = p.package_info;
            if (cs.classfile == null)
                cs.classfile = file;
        } else
            cs = reader.enterClass(name, file);
        list = list.prepend(cs);
    }
    return list.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:27,代码来源:JavacProcessingEnvironment.java

示例2: catchTypesWithAnnotationsFromMulticatch

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
List<Pair<List<Attribute.TypeCompound>, JCExpression>> catchTypesWithAnnotationsFromMulticatch(JCTypeUnion tree, List<TypeCompound> first) {
    List<JCExpression> alts = tree.alternatives;
    List<Pair<List<TypeCompound>, JCExpression>> res = List.of(new Pair<>(first, alts.head));
    alts = alts.tail;

    while(alts != null && alts.head != null) {
        JCExpression alt = alts.head;
        if (alt instanceof JCAnnotatedType) {
            JCAnnotatedType a = (JCAnnotatedType)alt;
            res = res.prepend(new Pair<>(annotate.fromAnnotations(a.annotations), alt));
        } else {
            res = res.prepend(new Pair<>(List.nil(), alt));
        }
        alts = alts.tail;
    }
    return res.reverse();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Gen.java

示例3: getTopLevelClasses

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) {
    List<ClassSymbol> classes = List.nil();
    for (JCCompilationUnit unit : units) {
        for (JCTree node : unit.defs) {
            if (node.getTag() == JCTree.CLASSDEF) {
                ClassSymbol sym = ((JCClassDecl) node).sym;
                Assert.checkNonNull(sym);
                classes = classes.prepend(sym);
            }
        }
    }
    return classes.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:JavacProcessingEnvironment.java

示例4: getTopLevelClassesFromClasses

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<ClassSymbol> getTopLevelClassesFromClasses(List<? extends ClassSymbol> syms) {
    List<ClassSymbol> classes = List.nil();
    for (ClassSymbol sym : syms) {
        if (!isPkgInfo(sym)) {
            classes = classes.prepend(sym);
        }
    }
    return classes.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:10,代码来源:JavacProcessingEnvironment.java

示例5: getPackageInfoFiles

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<PackageSymbol> getPackageInfoFiles(List<? extends JCCompilationUnit> units) {
    List<PackageSymbol> packages = List.nil();
    for (JCCompilationUnit unit : units) {
        if (isPkgInfo(unit.sourcefile, JavaFileObject.Kind.SOURCE)) {
            packages = packages.prepend(unit.packge);
        }
    }
    return packages.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:10,代码来源:JavacProcessingEnvironment.java

示例6: getPackageInfoFilesFromClasses

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<PackageSymbol> getPackageInfoFilesFromClasses(List<? extends ClassSymbol> syms) {
    List<PackageSymbol> packages = List.nil();
    for (ClassSymbol sym : syms) {
        if (isPkgInfo(sym)) {
            packages = packages.prepend((PackageSymbol) sym.owner);
        }
    }
    return packages.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:10,代码来源:JavacProcessingEnvironment.java

示例7: capture

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Capture conversion as specified by the JLS.
 */

public List<Type> capture(List<Type> ts) {
    List<Type> buf = List.nil();
    for (Type t : ts) {
        buf = buf.prepend(capture(t));
    }
    return buf.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:12,代码来源:Types.java

示例8: getTopLevelClasses

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) {
    List<ClassSymbol> classes = List.nil();
    for (JCCompilationUnit unit : units) {
        for (JCTree node : unit.defs) {
            if (node.hasTag(JCTree.Tag.CLASSDEF)) {
                ClassSymbol sym = ((JCClassDecl) node).sym;
                Assert.checkNonNull(sym);
                classes = classes.prepend(sym);
            }
        }
    }
    return classes.reverse();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:JavacProcessingEnvironment.java

示例9: getPlaceholders

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<Attribute.Compound> getPlaceholders() {
    List<Attribute.Compound> res = List.<Attribute.Compound>nil();
    for (Attribute.Compound a : filterDeclSentinels(attributes)) {
        if (a instanceof Placeholder) {
            res = res.prepend(a);
        }
    }
    return res.reverse();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:SymbolMetadata.java

示例10: getTypePlaceholders

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<Attribute.TypeCompound> getTypePlaceholders() {
    List<Attribute.TypeCompound> res = List.<Attribute.TypeCompound>nil();
    for (Attribute.TypeCompound a : type_attributes) {
        if (a instanceof Placeholder) {
            res = res.prepend(a);
        }
    }
    return res.reverse();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:SymbolMetadata.java

示例11: getModuleInfoFiles

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<ModuleSymbol> getModuleInfoFiles(List<? extends JCCompilationUnit> units) {
    List<ModuleSymbol> modules = List.nil();
    for (JCCompilationUnit unit : units) {
        if (isModuleInfo(unit.sourcefile, JavaFileObject.Kind.SOURCE) &&
            unit.defs.nonEmpty() &&
            unit.defs.head.hasTag(Tag.MODULEDEF)) {
            modules = modules.prepend(unit.modle);
        }
    }
    return modules.reverse();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JavacProcessingEnvironment.java

示例12: 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

示例13: getAttributesForCompletion

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private <T extends Attribute.Compound> List<T> getAttributesForCompletion(
        final Annotate.AnnotateRepeatedContext<T> ctx) {

    Map<Symbol.TypeSymbol, ListBuffer<T>> annotated = ctx.annotated;
    boolean atLeastOneRepeated = false;
    List<T> buf = List.<T>nil();
    for (ListBuffer<T> lb : annotated.values()) {
        if (lb.size() == 1) {
            buf = buf.prepend(lb.first());
        } else { // repeated
            // This will break when other subtypes of Attributs.Compound
            // are introduced, because PlaceHolder is a subtype of TypeCompound.
            T res;
            @SuppressWarnings("unchecked")
            T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym);
            res = ph;
            buf = buf.prepend(res);
            atLeastOneRepeated = true;
        }
    }

    if (atLeastOneRepeated) {
        // The Symbol s is now annotated with a combination of
        // finished non-repeating annotations and placeholders for
        // repeating annotations.
        //
        // We need to do this in two passes because when creating
        // a container for a repeating annotation we must
        // guarantee that the @Repeatable on the
        // contained annotation is fully annotated
        //
        // The way we force this order is to do all repeating
        // annotations in a pass after all non-repeating are
        // finished. This will work because @Repeatable
        // is non-repeating and therefore will be annotated in the
        // fist pass.

        // Queue a pass that will replace Attribute.Placeholders
        // with Attribute.Compound (made from synthesized containers).
        ctx.annotateRepeated(new Annotate.Worker() {
            @Override
            public String toString() {
                return "repeated annotation pass of: " + sym + " in: " + sym.owner;
            }

            @Override
            public void run() {
                complete(ctx);
            }
        });
    }
    // Add non-repeating attributes
    return buf.reverse();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:55,代码来源:SymbolMetadata.java


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