当前位置: 首页>>代码示例>>Java>>正文


Java Queues.newPriorityQueue方法代码示例

本文整理汇总了Java中com.google.common.collect.Queues.newPriorityQueue方法的典型用法代码示例。如果您正苦于以下问题:Java Queues.newPriorityQueue方法的具体用法?Java Queues.newPriorityQueue怎么用?Java Queues.newPriorityQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.Queues的用法示例。


在下文中一共展示了Queues.newPriorityQueue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCreateQueue

import com.google.common.collect.Queues; //导入方法依赖的package包/类
/**
 * 创建队列
 */
@Test
public void testCreateQueue() {
    List<String> strList = Lists.newArrayListWithExpectedSize(128);

    // 创建ArrayBlockingQueue
    ArrayBlockingQueue<String> blockingQueue = Queues.newArrayBlockingQueue(128);

    // 创建LinkedBlockingQueue
    LinkedBlockingQueue<String> linkedBlockingQueue1 = Queues.newLinkedBlockingQueue();
    LinkedBlockingQueue<String> linkedBlockingQueue2 = Queues.newLinkedBlockingQueue(128);
    LinkedBlockingQueue<String> linkedBlockingQueue3 = Queues.newLinkedBlockingQueue(strList);

    // 创建LinkedBlockingDeque
    LinkedBlockingDeque<String> blockingDeque1 = Queues.newLinkedBlockingDeque();
    LinkedBlockingDeque<String> blockingDeque2 = Queues.newLinkedBlockingDeque(128);
    LinkedBlockingDeque<String> blockingDeque3 = Queues.newLinkedBlockingDeque(strList);

    // 创建ArrayDeque
    ArrayDeque<String> arrayDeque1 = Queues.newArrayDeque();
    ArrayDeque<String> arrayDeque2 = Queues.newArrayDeque(strList);

    // 创建ConcurrentLinkedQueue
    ConcurrentLinkedQueue<String> concurrentLinkedQueue1 = Queues.newConcurrentLinkedQueue();
    ConcurrentLinkedQueue<String> concurrentLinkedQueue2 = Queues.newConcurrentLinkedQueue(strList);

    // 创建PriorityBlockingQueue
    PriorityBlockingQueue<String> priorityBlockingQueue1 = Queues.newPriorityBlockingQueue();
    PriorityBlockingQueue<String> priorityBlockingQueue2 = Queues.newPriorityBlockingQueue(strList);

    // 创建PriorityQueue
    PriorityQueue<Comparable> priorityQueue1 = Queues.newPriorityQueue();
    PriorityQueue<Comparable> priorityQueue2 = Queues.newPriorityQueue(strList);

    // 创建SynchronousQueue
    SynchronousQueue<String> synchronousQueue = Queues.newSynchronousQueue();
}
 
开发者ID:cbooy,项目名称:cakes,代码行数:40,代码来源:QueuesDemo.java

示例2: DataTable

import com.google.common.collect.Queues; //导入方法依赖的package包/类
public DataTable(final TableSchema<? extends SchemaDefiner<?>> schema,
		final String tableName, JavaTypeFactory typeFactory) {
	this.schema = schema;
	this.tableName = tableName;
	plans = Queues.newPriorityQueue();
	aggregationPlans = Queues.newPriorityQueue();
	resultSet = new BaseIterable<T>();
	javaFactory = typeFactory;
	this.metadata = schema.metaData;


}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:13,代码来源:DataTable.java

示例3: ChunkRenderDispatcher

import com.google.common.collect.Queues; //导入方法依赖的package包/类
public ChunkRenderDispatcher(int p_i1_1_)
{
    this.listWorkerThreads = Lists.<Thread>newArrayList();
    this.listThreadedWorkers = Lists.<ChunkRenderWorker>newArrayList();
    this.queueChunkUpdates = Queues.<ChunkCompileTaskGenerator>newPriorityBlockingQueue();
    this.worldVertexUploader = new WorldVertexBufferUploader();
    this.vertexUploader = new VertexBufferUploader();
    this.queueChunkUploads = Queues.<ChunkRenderDispatcher.PendingUpload>newPriorityQueue();
    int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760);
    int j = Math.max(1, MathHelper.clamp(Runtime.getRuntime().availableProcessors(), 1, i / 5));

    if (p_i1_1_ < 0)
    {
        this.countRenderBuilders = MathHelper.clamp(j, 1, i);
    }
    else
    {
        this.countRenderBuilders = p_i1_1_;
    }

    if (j > 1)
    {
        for (int k = 0; k < j; ++k)
        {
            ChunkRenderWorker chunkrenderworker = new ChunkRenderWorker(this);
            Thread thread = THREAD_FACTORY.newThread(chunkrenderworker);
            thread.start();
            this.listThreadedWorkers.add(chunkrenderworker);
            this.listWorkerThreads.add(thread);
        }
    }

    this.queueFreeRenderBuilders = Queues.<RegionRenderCacheBuilder>newArrayBlockingQueue(this.countRenderBuilders);

    for (int l = 0; l < this.countRenderBuilders; ++l)
    {
        this.queueFreeRenderBuilders.add(new RegionRenderCacheBuilder());
    }

    this.renderWorker = new ChunkRenderWorker(this, new RegionRenderCacheBuilder());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:42,代码来源:ChunkRenderDispatcher.java

示例4: Scheduler

import com.google.common.collect.Queues; //导入方法依赖的package包/类
Scheduler(Ticker ticker) {
  this.queue = Queues.newPriorityQueue();
  this.ticker = ticker;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-management-java,代码行数:5,代码来源:Client.java


注:本文中的com.google.common.collect.Queues.newPriorityQueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。