當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。