本文整理了Java中com.sun.tools.javac.util.List.prepend()
方法的一些代码示例,展示了List.prepend()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.prepend()
方法的具体详情如下:
包路径:com.sun.tools.javac.util.List
类名称:List
方法名:prepend
[英]Prepend given element to front of list, forming and returning a new list.
[中]将给定元素前置到列表前面,形成并返回一个新列表。
代码示例来源:origin: google/error-prone
ConsumptionState consume(JCStatement impl) {
return new AutoValue_UPlaceholderStatement_ConsumptionState(
consumedStatements() + 1, placeholderImplInReverseOrder().prepend(impl));
}
}
代码示例来源:origin: google/error-prone
private Choice<State<PlaceholderParamIdent>> unifyParam(
final UVariableDecl placeholderParam,
UExpression placeholderArg,
ExpressionTree toUnify,
final State<?> state) {
return placeholderArg
.unify(toUnify, state.unifier())
.transform(
(Unifier unifier) ->
State.create(
state.seenParameters().prepend(placeholderParam),
unifier,
new PlaceholderParamIdent(placeholderParam, unifier.getContext())));
}
代码示例来源:origin: google/error-prone
expectedTypes = expectedTypes.prepend(returnType().inline(inliner));
Type ty = target.type;
actualTypes = actualTypes.prepend(ty);
代码示例来源:origin: google/error-prone
statements.subList(consumedStatements, statements.size()),
context)
.transform(list -> list.prepend(match));
代码示例来源:origin: google/error-prone
public Choice<State<List<JCTree>>> unify(
@Nullable Iterable<? extends Tree> nodes, State<?> state) {
if (nodes == null) {
return Choice.of(state.<List<JCTree>>withResult(null));
}
Choice<State<List<JCTree>>> choice = Choice.of(state.withResult(List.<JCTree>nil()));
for (final Tree node : nodes) {
choice =
choice.thenChoose(
(State<List<JCTree>> s) ->
unify(node, s)
.transform(
treeState ->
treeState.withResult(s.result().prepend(treeState.result()))));
}
return choice.transform(s -> s.withResult(s.result().reverse()));
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
/** Prepend an element to buffer.
*/
public ListBuffer<A> prepend(A x) {
elems = elems.prepend(x);
count++;
return this;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/** Prepend an element to buffer.
*/
public ListBuffer<A> prepend(A x) {
elems = elems.prepend(x);
if (last == null) last = elems;
count++;
return this;
}
代码示例来源:origin: sc.fiji/javac
/** Add a new resource bundle to the list that is searched for localized messages.
* Resource bundles will be searched in reverse order in which they are added.
* @param bundle the bundle of localized messages.
*/
public void add(ResourceBundle bundle) {
bundles = bundles.prepend(bundle);
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
/**
* 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;
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
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();
}
代码示例来源:origin: com.google.errorprone/error_prone_core
ConsumptionState consume(JCStatement impl) {
return new AutoValue_UPlaceholderStatement_ConsumptionState(
consumedStatements() + 1, placeholderImplInReverseOrder().prepend(impl));
}
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
public java.util.List<Symbol> getEnclosedElements() {
List<Symbol> list = List.nil();
for (Scope.Entry e = members().elems; e != null; e = e.sibling) {
if (e.sym != null && (e.sym.flags() & SYNTHETIC) == 0 && e.sym.owner == this)
list = list.prepend(e.sym);
}
return list;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/** Return all exceptions in thrown list that are not in handled list.
* @param thrown The list of thrown exceptions.
* @param handled The list of handled exceptions.
*/
List<Type> unhandled(List<Type> thrown, List<Type> handled) {
List<Type> unhandled = List.nil();
for (List<Type> l = thrown; l.nonEmpty(); l = l.tail)
if (!isHandled(l.head, handled)) unhandled = unhandled.prepend(l.head);
return unhandled;
}
代码示例来源:origin: sc.fiji/javac
public static List<Name> enclosingCandidates(Name name) {
List<Name> names = List.nil();
int index;
while ((index = name.lastIndexOf((byte)'$')) > 0) {
name = name.subName(0, index);
names = names.prepend(name);
}
return names;
}
}
代码示例来源:origin: sc.fiji/javac
/** Return all exceptions in thrown list that are not in handled list.
* @param thrown The list of thrown exceptions.
* @param handled The list of handled exceptions.
*/
List<Type> unHandled(List<Type> thrown, List<Type> handled) {
List<Type> unhandled = List.nil();
for (List<Type> l = thrown; l.nonEmpty(); l = l.tail)
if (!isHandled(l.head, handled)) unhandled = unhandled.prepend(l.head);
return unhandled;
}
代码示例来源:origin: konsoletyper/teavm-javac
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();
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
void writeMethods(Scope.Entry e) {
List<MethodSymbol> methods = List.nil();
for (Scope.Entry i = e; i != null; i = i.sibling) {
if (i.sym.kind == MTH && (i.sym.flags() & HYPOTHETICAL) == 0)
methods = methods.prepend((MethodSymbol)i.sym);
}
while (methods.nonEmpty()) {
writeMethod(methods.head);
methods = methods.tail;
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
List<Type> subst(List<Type> ts) {
if (from.tail == null)
return ts;
boolean wild = false;
if (ts.nonEmpty() && from.nonEmpty()) {
Type head1 = subst(ts.head);
List<Type> tail1 = subst(ts.tail);
if (head1 != ts.head || tail1 != ts.tail)
return tail1.prepend(head1);
}
return ts;
}
代码示例来源:origin: konsoletyper/teavm-javac
void writeMethods(Scope.Entry e) {
List<MethodSymbol> methods = List.nil();
for (Scope.Entry i = e; i != null; i = i.sibling) {
if (i.sym.kind == MTH && (i.sym.flags() & HYPOTHETICAL) == 0)
methods = methods.prepend((MethodSymbol)i.sym);
}
while (methods.nonEmpty()) {
writeMethod(methods.head);
methods = methods.tail;
}
}
代码示例来源:origin: konsoletyper/teavm-javac
@Override
public java.util.List<Symbol> getEnclosedElements() {
List<Symbol> list = List.nil();
if (kind == TYP && type.hasTag(TYPEVAR)) {
return list;
}
for (Scope.Entry e = members().elems; e != null; e = e.sibling) {
if (e.sym != null && (e.sym.flags() & SYNTHETIC) == 0 && e.sym.owner == this)
list = list.prepend(e.sym);
}
return list;
}
内容来源于网络,如有侵权,请联系作者删除!