本文整理了Java中scala.collection.immutable.List
类的一些代码示例,展示了List
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List
类的具体详情如下:
包路径:scala.collection.immutable.List
类名称:List
暂无
代码示例来源:origin: org.apache.kafka/kafka_2.10
if (!adminClient.describeConsumerGroup(groupId).consumers().get().isEmpty()) {
throw new IllegalStateException("Consumer group '" + groupId + "' is still active. " +
"Make sure to stop all running application instances before running the reset tool.");
代码示例来源: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.mangofactory.swagger/swagger-models
private boolean allowableValuesIsEmpty(Optional<AllowableListValues> listValues) {
return !listValues.isPresent() || listValues.get().values().size() == 0;
}
代码示例来源:origin: kframework/k-legacy
@Override
public T next() {
T head = l.head();
l = (scala.collection.immutable.List<T>) l.tail();
return head;
}
};
代码示例来源:origin: fluxtream/fluxtream-app
public ClassModel(Model m){
id = m.id();
name = m.name();
qualifiedType = m.qualifiedType();
description = m.description().isEmpty() ? null : m.description().get();
baseModel = m.baseModel().isEmpty() ? null : m.baseModel().get();
discriminator = m.discriminator().isEmpty() ? null : m.discriminator().get();
properties = new HashMap<String,ClassModelProperty>();
LinkedHashMap<String,ModelProperty> propertiesMap = m.properties();
Iterator<Tuple2<String,ModelProperty>> i = propertiesMap.iterator();
while (i.hasNext()){
Tuple2<String,ModelProperty> t = i.next();
properties.put(t._1(),new ClassModelProperty(t._2()));
}
subTypes = new ArrayList<String>();
Iterator<String> stypes = m.subTypes().iterator();
while (stypes.hasNext())
subTypes.add(stypes.next());
}
代码示例来源:origin: com.cerner.common.kafka/common-kafka-admin
return Collections.unmodifiableCollection(convertToJavaSet(summary.consumers().get().iterator()));
代码示例来源:origin: vakinge/jeesuite-libs
public ConsumerGroupInfo consumerGroup(KafkaConsumer<String, Serializable> kafkaConsumer,String group){
scala.collection.immutable.List<ConsumerSummary> consumers = groupSummary.consumers().get();
if(consumers.isEmpty()){
System.out.println("Consumer group ["+group+"] does not exist or is rebalancing.");
return null;
consumerGroup.setActived(true);
consumerGroup.setGroupName(group);
Iterator<ConsumerSummary> iterator = consumers.iterator();
while (iterator.hasNext()) {
ConsumerSummary consumer = iterator.next();
Iterator<TopicPartition> iterator2 = partitions.iterator();
代码示例来源: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: wkennedy/swagger4spring-web
private Map<String, ApiListing> processControllers(Set<Class<?>> controllerClasses) {
//Loop over end points (controllers)
for (Class<?> controllerClass : controllerClasses) {
if (ApiDocumentationController.class.isAssignableFrom(controllerClass)) {
continue;
}
Set<Method> requestMappingMethods = AnnotationUtils.getAnnotatedMethods(controllerClass, RequestMapping.class);
ApiListing apiListing = processControllerApi(controllerClass);
String description = "";
Api controllerApi = controllerClass.getAnnotation(Api.class);
if (controllerApi != null) {
description = controllerApi.description();
}
if (apiListing.apis().size() == 0) {
apiListing = processMethods(requestMappingMethods, controllerClass, apiListing, description);
}
//Allow for multiple controllers having the same resource path.
ApiListing existingApiListing = apiListingMap.get(apiListing.resourcePath());
if (existingApiListing != null) {
apiListing = ApiListingUtil.mergeApiListing(existingApiListing, apiListing);
}
// controllers without any operations are excluded from the apiListingMap list
if (apiListing.apis() != null && !apiListing.apis().isEmpty()) {
apiListingMap.put(apiListing.resourcePath(), apiListing);
}
}
return apiListingMap;
}
代码示例来源:origin: kframework/k-legacy
@Override
public boolean hasNext() {
return !l.isEmpty();
}
代码示例来源:origin: kframework/k
constraints[i] = constraints[i].add(new LocalRewriteTerm(path.reverse(), innerRHSRewrite.theRHS[i]), BoolToken.TRUE);
ruleMask = match(subjectKList.get(i), patternKList.get(i), ruleMask, path.$colon$colon(Pair.of(i, i + 1)));
if (ruleMask.isEmpty()) {
return ruleMask;
代码示例来源:origin: phuonglh/vn.vitk
Set<Integer> labels = new HashSet<Integer>();
scala.collection.immutable.List<Integer> list = tuple._2().toList();
for (int i = 0; i < list.size(); i++)
labels.add(list.apply(i));
tagDict.put(tuple._1(), labels);
代码示例来源:origin: kframework/k
pattern.range(patternIndex, pattern.size()),
ruleMask,
subject instanceof BuiltinList.SingletonBuiltinList ? path : path.$colon$colon(Pair.of(subjectIndex, subject.size())));
elementMask.and(ruleMask);
if (!elementMask.isEmpty()) {
elementMask = match(subject.get(subjectIndex), patternElementTailSplit.element, elementMask, subject instanceof BuiltinList.SingletonBuiltinList ? path : path.$colon$colon(Pair.of(subjectIndex, subjectIndex + 1)));
if (!elementMask.isEmpty()) {
elementMask = matchAssoc(subject, subjectIndex + 1, pattern, patternIndex + 1, elementMask, path);
tailMask.and(ruleMask);
if (!tailMask.isEmpty()) {
tailMask = match(subject.range(subjectIndex, subject.size()), patternElementTailSplit.tail, tailMask, path.$colon$colon(Pair.of(subjectIndex, subject.size())));
pattern.range(patternIndex, pattern.size()),
ruleMask,
subject instanceof BuiltinList.SingletonBuiltinList ? path : path.$colon$colon(Pair.of(subjectIndex, subject.size())));
ruleMask = match(subject.range(subjectIndex, i), pattern.get(patternIndex), ruleMask, subject instanceof BuiltinList.SingletonBuiltinList ? path : path.$colon$colon(Pair.of(subjectIndex, i)));
代码示例来源: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);
代码示例来源:origin: fluxtream/fluxtream-app
@GET
@Path("/get")
@Produces({MediaType.APPLICATION_JSON})
public Response test(@QueryParam("class") String className){
try{
if (className == null)
throw new ClassNotFoundException();
List<ClassModel> list = new ArrayList<ClassModel>();
Iterator<Model> i = ModelConverters.readAll(Class.forName(className)).iterator();
while (i.hasNext())
list.add(new ClassModel(i.next()));
return Response.ok(list).build();
}
catch (ClassNotFoundException e) {
return Response.status(400).entity("Could not find " + className).build();
}
catch (Exception e){
return Response.status(500).entity("An error occurred: " + e.getMessage()).build();
}
}
代码示例来源:origin: vakinge/jeesuite-libs
public List<BrokerInfo> fetchAllBrokers(){
List<BrokerInfo> result = new ArrayList<>();
Seq<Broker> brokers = zkUtils.getAllBrokersInCluster();
Iterator<Broker> iterator = brokers.toList().iterator();
while(iterator.hasNext()){
Broker broker = iterator.next();
Node node = broker.getNode(ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT)).get();
result.add(new BrokerInfo(node.idString(), node.host(), node.port()));
}
return result;
}
代码示例来源:origin: kframework/k
if (rewrites.size() == 1 && rewrites.get(0).getLeft().isEmpty()) {
return rewrites.get(0).getRight().substituteAndEvaluate(substitution, context);
Map<Pair<Integer, Integer>, List<Pair<scala.collection.immutable.List<Pair<Integer, Integer>>, Term>>> commonPath = rewrites.stream().collect(Collectors.groupingBy(rw -> rw.getLeft().head()));
(scala.collection.immutable.List<Pair<Integer, Integer>>) p.getLeft().tail(), p.getRight())).collect(Collectors.toList());
newContents.add(buildRHS(contents.get(i), substitution, theInnerRewrites, context));
} else {
代码示例来源:origin: kframework/k
@Override
public T next() {
T head = l.head();
l = (scala.collection.immutable.List<T>) l.tail();
return head;
}
};
代码示例来源:origin: kframework/k
@Override
public boolean hasNext() {
return !l.isEmpty();
}
代码示例来源:origin: vakinge/jeesuite-libs
protected List<String> group() {
List<String> groups = new ArrayList<>();
scala.collection.immutable.List<GroupOverview> list = adminClient.listAllConsumerGroupsFlattened();
if (list == null)
return groups;
Iterator<GroupOverview> iterator = list.iterator();
while (iterator.hasNext()) {
groups.add(iterator.next().groupId());
}
return groups;
}
内容来源于网络,如有侵权,请联系作者删除!