本文整理了Java中scala.collection.immutable.List.head()
方法的一些代码示例,展示了List.head()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.head()
方法的具体详情如下:
包路径:scala.collection.immutable.List
类名称:List
方法名:head
暂无
代码示例来源:origin: kframework/k
@Override
public T next() {
T head = l.head();
l = (scala.collection.immutable.List<T>) l.tail();
return head;
}
};
代码示例来源:origin: kframework/k-legacy
@Override
public T next() {
T head = l.head();
l = (scala.collection.immutable.List<T>) l.tail();
return head;
}
};
代码示例来源:origin: kframework/k
Map<Pair<Integer, Integer>, List<Pair<scala.collection.immutable.List<Pair<Integer, Integer>>, Term>>> commonPath = rewrites.stream().collect(Collectors.groupingBy(rw -> rw.getLeft().head()));
代码示例来源:origin: kframework/k
/**
* goes down the path on the subject to find the rewrite place, does the substitution, and reconstructs the term
* on its way up
*/
private Term buildRHS(Term subject, Substitution<Variable, Term> substitution, scala.collection.immutable.List<Pair<Integer, Integer>> path, Term rhs, TermContext context) {
if (path.isEmpty()) {
return rhs.substituteAndEvaluate(substitution, context);
} else {
if (subject instanceof KItem) {
KItem kItemSubject = (KItem) subject;
List<Term> newContents = new ArrayList<>(((KList) kItemSubject.kList()).getContents());
//noinspection RedundantCast
newContents.set(path.head().getLeft(), buildRHS(newContents.get(path.head().getLeft()), substitution,
(scala.collection.immutable.List<Pair<Integer, Integer>>) path.tail(), rhs, context));
return KItem.of(kItemSubject.kLabel(), KList.concatenate(newContents), context.global()).applyAnywhereRules(context);
} else if (subject instanceof BuiltinList) {
BuiltinList builtinListSubject = (BuiltinList) subject;
List<Term> newContents = new ArrayList<>(builtinListSubject.children);
//noinspection RedundantCast
newContents.set(path.head().getLeft(), buildRHS(newContents.get(path.head().getLeft()), substitution,
(scala.collection.immutable.List<Pair<Integer, Integer>>) path.tail(), rhs, context));
return BuiltinList
.builder(builtinListSubject.sort, builtinListSubject.operatorKLabel, builtinListSubject.unitKLabel, builtinListSubject.globalContext())
.addAll(newContents)
.build();
} else {
throw new AssertionError("unexpected rewrite in subject: " + subject);
}
}
}
代码示例来源:origin: com.twitter/util-core_2.11
/**
* Creates a new `Spool` of given `elems`.
*/
@SuppressWarnings("unchecked")
public static <T> Spool<T> newSpool(Collection<T> elems) {
List<T> buffer = (List<T>)List.empty();
for (T item : elems) {
buffer = buffer.$colon$colon(item);
}
Spool<T> result = (Spool<T>)EMPTY;
while(!buffer.isEmpty()){
result = new Spool.Cons<T>(buffer.head(), Future.value(result));
buffer = (List<T>)buffer.tail();
}
return result;
}
代码示例来源:origin: com.twitter/util-core_2.12
/**
* Creates a new `Spool` of given `elems`.
*/
@SuppressWarnings("unchecked")
public static <T> Spool<T> newSpool(Collection<T> elems) {
List<T> buffer = (List<T>)List.empty();
for (T item : elems) {
buffer = buffer.$colon$colon(item);
}
Spool<T> result = (Spool<T>)EMPTY;
while(!buffer.isEmpty()){
result = new Spool.Cons<T>(buffer.head(), Future.value(result));
buffer = (List<T>)buffer.tail();
}
return result;
}
代码示例来源:origin: org.apache.activemq/apollo-mqtt
SimpleAddress topic = delivery.sender().head().simple();
} else {
PUBLISH publish = new PUBLISH();
publish.topicName(new UTF8Buffer(destination_parser.encode_destination(delivery.sender().head())));
if (delivery.redeliveries() > 0) {
publish.dup(true);
内容来源于网络,如有侵权,请联系作者删除!