當前位置: 首頁>>代碼示例>>Java>>正文


Java Iterators.cycle方法代碼示例

本文整理匯總了Java中com.google.common.collect.Iterators.cycle方法的典型用法代碼示例。如果您正苦於以下問題:Java Iterators.cycle方法的具體用法?Java Iterators.cycle怎麽用?Java Iterators.cycle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.Iterators的用法示例。


在下文中一共展示了Iterators.cycle方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ExternalSortBatch

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public ExternalSortBatch(ExternalSort popConfig, FragmentContext context, RecordBatch incoming) throws OutOfMemoryException {
  super(popConfig, context, true);
  this.incoming = incoming;
  DrillConfig config = context.getConfig();
  Configuration conf = new Configuration();
  conf.set("fs.default.name", config.getString(ExecConstants.EXTERNAL_SORT_SPILL_FILESYSTEM));
  try {
    this.fs = FileSystem.get(conf);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  SPILL_BATCH_GROUP_SIZE = config.getInt(ExecConstants.EXTERNAL_SORT_SPILL_GROUP_SIZE);
  SPILL_THRESHOLD = config.getInt(ExecConstants.EXTERNAL_SORT_SPILL_THRESHOLD);
  dirs = Iterators.cycle(config.getStringList(ExecConstants.EXTERNAL_SORT_SPILL_DIRS));
  copierAllocator = oContext.getAllocator().getChildAllocator(
      context, PriorityQueueCopier.INITIAL_ALLOCATION, PriorityQueueCopier.MAX_ALLOCATION, true);
  FragmentHandle handle = context.getHandle();
  fileName = String.format("%s/major_fragment_%s/minor_fragment_%s/operator_%s", QueryIdHelper.getQueryId(handle.getQueryId()),
      handle.getMajorFragmentId(), handle.getMinorFragmentId(), popConfig.getOperatorId());
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:21,代碼來源:ExternalSortBatch.java

示例2: manyFiles

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Test
public void manyFiles() throws Exception {
  List<CompleteFileWork> chunks = generateChunks(1000);

  Iterator<DrillbitEndpoint> incomingEndpointsIterator = Iterators.cycle(endpoints);

  List<DrillbitEndpoint> incomingEndpoints = Lists.newArrayList();

  final int width = 28 * 30;
  for (int i = 0; i < width; i++) {
    incomingEndpoints.add(incomingEndpointsIterator.next());
  }

  ListMultimap<Integer, CompleteFileWork> mappings = AssignmentCreator.getMappings(incomingEndpoints, chunks, null);
  System.out.println(mappings.keySet().size());
  for (int i = 0; i < width; i++) {
    Assert.assertTrue("no mapping for entry " + i, mappings.get(i) != null && mappings.get(i).size() > 0);
  }
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:20,代碼來源:TestAssignment.java

示例3: recalculateOrdering

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
private void recalculateOrdering() {
    // clear ordering
    order.clear();

    // Create new ordering, probably a better way to do this...
    for (Map.Entry<VirtualSpoutIdentifier, Boolean> entry: allIds.entrySet()) {
        // If throttled
        if (entry.getValue()) {
            order.add(entry.getKey());
        } else {
            // Add entries at ratio
            for (int x = 0; x < ratio; x++) {
                order.add(entry.getKey());
            }
        }
    }

    // create new iterator that cycles endlessly
    consumerIdIterator = Iterators.cycle(order);
}
 
開發者ID:salesforce,項目名稱:storm-dynamic-spout,代碼行數:21,代碼來源:RatioMessageBuffer.java

示例4: manyFiles

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Test
public void manyFiles() throws Exception {
  List<CompleteWork> chunks = generateChunks(1000);

  Iterator<NodeEndpoint> incomingEndpointsIterator = Iterators.cycle(endpoints);

  List<NodeEndpoint> incomingEndpoints = Lists.newArrayList();

  final int width = 28 * 30;
  for (int i = 0; i < width; i++) {
    incomingEndpoints.add(incomingEndpointsIterator.next());
  }

  ListMultimap<Integer, CompleteWork> mappings = AssignmentCreator.getMappings(incomingEndpoints, chunks);
  System.out.println(mappings.keySet().size());
  for (int i = 0; i < width; i++) {
    Assert.assertTrue("no mapping for entry " + i, mappings.get(i) != null && mappings.get(i).size() > 0);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:20,代碼來源:TestAssignment.java

示例5: getIterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
private Iterator<Martini> getIterator(Mixologist mixologist) {
	String spelFilter = super.getPropertyAsString(ARGUMENT_SPEL_FILTER).trim();
	Collection<Martini> martiniCollection =
		spelFilter.isEmpty() ? mixologist.getMartinis() : mixologist.getMartinis(spelFilter);
	List<Martini> martinis = new ArrayList<>(martiniCollection);

	boolean shuffled = super.getPropertyAsBoolean(ARGUMENT_SHUFFLED_ITERATION);
	if (shuffled) {
		SecureRandom random = new SecureRandom();
		Collections.shuffle(martinis, random);
	}

	boolean cyclic = super.getPropertyAsBoolean(ARGUMENT_CYCLIC_ITERATOR);
	return cyclic ? Iterators.cycle(martinis) : Iterators.consumingIterator(martinis.iterator());
}
 
開發者ID:qas-guru,項目名稱:martini-jmeter-extension,代碼行數:16,代碼來源:MartiniPreProcessor.java

示例6: TrackerClientProvider

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public TrackerClientProvider(final TorrentWithStats torrent, final ConnectionHandler connectionHandler, final BitTorrentClient bitTorrentClient) {
    this.torrent = torrent;
    this.connectionHandler = connectionHandler;
    this.bitTorrentClient = bitTorrentClient;
    final Set<URI> addresses = torrent.getTorrent().getAnnounceList().stream()
            .unordered()
            .flatMap(Collection::stream)
            .collect(Collectors.toSet());

    this.addressIterator = Iterators.cycle(addresses);
    this.addressesCount = addresses.size();
}
 
開發者ID:anthonyraymond,項目名稱:joal,代碼行數:13,代碼來源:TrackerClientProvider.java

示例7: reset

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
private void reset() {
  allFilesCyclic = Iterators.cycle(files.values());
  restart();
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:5,代碼來源:VirtualFile.java


注:本文中的com.google.common.collect.Iterators.cycle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。