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