本文整理汇总了Java中org.apache.commons.collections.list.UnmodifiableList类的典型用法代码示例。如果您正苦于以下问题:Java UnmodifiableList类的具体用法?Java UnmodifiableList怎么用?Java UnmodifiableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnmodifiableList类属于org.apache.commons.collections.list包,在下文中一共展示了UnmodifiableList类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAllRecordsFromTopic
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
@Override
public <K, V> Collection<ConsumerRecord<K, V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout) {
List<ConsumerRecord<K, V>> result = new ArrayList<>();
try (KafkaConsumer<K, V> consumer = new KafkaConsumer<>(properties)) {
consumer.assign(Arrays.asList(new TopicPartition(topic, partition)));
while (true) {
boolean processedAtLeastOneRecord = false;
Iterator<ConsumerRecord<K, V>> iterator = consumer.poll(timeout).iterator();
while (iterator.hasNext()) {
ConsumerRecord<K, V> record = iterator.next();
result.add(record);
processedAtLeastOneRecord = true;
}
if (!processedAtLeastOneRecord) {
break;
}
}
consumer.commitSync();
}
return UnmodifiableList.decorate(result);
}
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:KafkaTestEnvironmentImpl.java
示例2: getAllRecordsFromTopic
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
@Override
public <K, V> Collection<ConsumerRecord<K, V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout) {
List<ConsumerRecord<K, V>> result = new ArrayList<>();
try (KafkaConsumer<K, V> consumer = new KafkaConsumer<>(properties)) {
consumer.subscribe(new TopicPartition(topic, partition));
while (true) {
Map<String, ConsumerRecords<K, V>> topics = consumer.poll(timeout);
if (topics == null || !topics.containsKey(topic)) {
break;
}
List<ConsumerRecord<K, V>> records = topics.get(topic).records(partition);
result.addAll(records);
if (records.size() == 0) {
break;
}
}
consumer.commit(true);
}
return UnmodifiableList.decorate(result);
}
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:KafkaTestEnvironmentImpl.java
示例3: getAllRecordsFromTopic
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
@Override
public <K, V> Collection<ConsumerRecord<K, V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout) {
List<ConsumerRecord<K, V>> result = new ArrayList<>();
try (KafkaConsumer<K, V> consumer = new KafkaConsumer<>(properties)) {
consumer.assign(Arrays.asList(new TopicPartition(topic, partition)));
while (true) {
boolean processedAtLeastOneRecord = false;
// wait for new records with timeout and break the loop if we didn't get any
Iterator<ConsumerRecord<K, V>> iterator = consumer.poll(timeout).iterator();
while (iterator.hasNext()) {
ConsumerRecord<K, V> record = iterator.next();
result.add(record);
processedAtLeastOneRecord = true;
}
if (!processedAtLeastOneRecord) {
break;
}
}
consumer.commitSync();
}
return UnmodifiableList.decorate(result);
}
开发者ID:axbaretto,项目名称:flink,代码行数:28,代码来源:KafkaTestEnvironmentImpl.java
示例4: getRdns
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
/**
* Retrieves all the components of this name.
*
* @return All the components
*/
@SuppressWarnings("unchecked")
public List<Rdn> getRdns()
{
return UnmodifiableList.decorate( rdns );
}
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:Dn.java
示例5: getConfiguration
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
/**
* Returns the configuration of this instance - implemented for testing purpose only
* @return
*/
@SuppressWarnings("unchecked")
protected List<ProjectionMapperConfiguration> getConfiguration() {
return UnmodifiableList.decorate(this.configuration);
}
开发者ID:ottogroup,项目名称:flink-operator-library,代码行数:9,代码来源:JsonContentProjectionMapper.java
示例6: getColumnNames
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getColumnNames() {
return UnmodifiableList.decorate(simpleColumnNames);
}
开发者ID:coastland,项目名称:gsp-dba-maven-plugin,代码行数:5,代码来源:ViewAnalyzer.java
示例7: getOrderedRights
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<UserRight> getOrderedRights()
{
return UnmodifiableList.decorate(orderedRights);
}
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:6,代码来源:UserRights.java
示例8: getList
import org.apache.commons.collections.list.UnmodifiableList; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getList() {
return UnmodifiableList.decorate(_list);
}
开发者ID:dfci-cccb,项目名称:mev,代码行数:5,代码来源:TopList.java
注:本文中的org.apache.commons.collections.list.UnmodifiableList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论