本文整理汇总了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();
}
示例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;
}
示例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());
}
示例4: Scheduler
import com.google.common.collect.Queues; //导入方法依赖的package包/类
Scheduler(Ticker ticker) {
this.queue = Queues.newPriorityQueue();
this.ticker = ticker;
}