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


Java ArrayListMultimap.put方法代碼示例

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


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

示例1: getExistingEntriesForVirtualNodes

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
@Override
@Transactional
public ListMultimap<String, AccessEntry> getExistingEntriesForVirtualNodes(Node... nodes)
{
	Collection<Integer> priorities = Lists.newArrayList();
	for( Node node : nodes )
	{
		if( !node.isVirtual() )
		{
			throw new IllegalArgumentException("Not a virtual node");
		}
		priorities.add(node.getOverridePriority());
		priorities.add(-node.getOverridePriority());
	}
	List<AccessEntry> entries = aclDao.getVirtualAccessEntries(priorities);
	ArrayListMultimap<String, AccessEntry> map = ArrayListMultimap.create();
	for( AccessEntry accessEntry : entries )
	{
		map.put(accessEntry.getTargetObject() + Integer.toString(Math.abs(accessEntry.getAclPriority())),
			accessEntry);
	}
	return map;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:24,代碼來源:TLEAclManagerImpl.java

示例2: register

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
private <C,I> void register(Class<? extends I> clazz, ArrayListMultimap<String,Class<? extends I>> methods) {
  Description desc = clazz.getAnnotation(Description.class);
  String[] names;
  if (desc != null) {
    names = desc.name().split(",");
    for (int i=0; i<names.length; i++) {
      names[i] = names[i].trim();
    }
  }else{
    names = new String[]{clazz.getName().replace('.', '_')};
  }

  UDFType type = clazz.getAnnotation(UDFType.class);
  if (type != null && type.deterministic()) {
    nonDeterministicUDFs.add(clazz);
  }


  for(int i=0; i<names.length;i++) {
    methods.put(names[i].toLowerCase(), clazz);
  }
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:23,代碼來源:HiveFunctionRegistry.java

示例3: loadHsnp

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
private static ArrayListMultimap<Long, Speed> loadHsnp(String filename) {
    File file = new File(filename);
    ArrayListMultimap<Long, Speed> speeds = ArrayListMultimap.create();
    if (!file.exists()) {
        log.info("File not found : {}", file.getAbsolutePath());
        return speeds;
    }

    log.info("Reading HSNP {}", file);
    try (DbfReader reader = new DbfReader(file)) {
        DbfRow row;
        while ((row = reader.nextRow()) != null) {
            Speed speed = parse(row);
            speeds.put(speed.getId(), speed);
        }
    }
    log.info("Loaded {} speed profile", speeds.size());
    return speeds;
}
 
開發者ID:Mappy,項目名稱:fpm,代碼行數:20,代碼來源:HsnpDbf.java

示例4: ldFile

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
private static Map<Long, List<String>> ldFile(TomtomFolder folder) {
    File file = new File(folder.getFile("ld.dbf"));
    if (!file.exists()) {
        return newHashMap();
    }
    ArrayListMultimap<Long, LaneDirection> directions = ArrayListMultimap.create();
    log.info("Reading LD {}", file);
    try (DbfReader reader = new DbfReader(file)) {
        DbfRow row;
        while ((row = reader.nextRow()) != null) {
            directions.put(row.getLong("ID"), LaneDirection.parse(row.getInt("DIRECTION"), row.getString("VALIDITY")));
        }
    }
    Map<Long, List<String>> tags = newHashMap();
    for (Long id : directions.keySet()) {
        tags.put(id, asText(directions.get(id)));
    }
    log.info("Loaded {} lane directions", directions.size());
    return tags;
}
 
開發者ID:Mappy,項目名稱:fpm,代碼行數:21,代碼來源:LdDbf.java

示例5: loadSpeedRestrictions

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
private static ArrayListMultimap<Long, SpeedRestriction> loadSpeedRestrictions(String filename) {
    ArrayListMultimap<Long, SpeedRestriction> restrictions = ArrayListMultimap.create();
    File file = new File(filename);
    if (!file.exists()) {
        log.info("File not found : {}", file.getAbsolutePath());
        return restrictions;
    }
    log.info("Reading SR {}", file);
    try (DbfReader reader = new DbfReader(file)) {
        DbfRow row;
        while ((row = reader.nextRow()) != null) {
            SpeedRestriction restriction = new SpeedRestriction(row.getLong("ID"), row.getInt("SPEED"), Validity.values()[row.getInt("VALDIR") - 1]);
            restrictions.put(restriction.getId(), restriction);
        }
    }
    log.info("Loaded {} speed restrictions", restrictions.size());

    return restrictions;
}
 
開發者ID:Mappy,項目名稱:fpm,代碼行數:20,代碼來源:SrDbf.java

示例6: publiceerSchrijfTaken

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
@Override
public int publiceerSchrijfTaken(final SelectieVerwerkTaakBericht selectieTaak, final Collection<VerwerkPersoonResultaat> resultaten) {
    final ArrayListMultimap<Integer, VerwerkPersoonResultaat> berichtenPerSelectietaak = ArrayListMultimap.create();
    for (VerwerkPersoonResultaat resultaat : resultaten) {
        berichtenPerSelectietaak.put(resultaat.getSelectieTaakId(), resultaat);
    }

    final List<SelectieFragmentSchrijfBericht> schrijfTaken = new ArrayList<>();
    for (SelectieAutorisatieBericht selectieAutorisatie : selectieTaak.getSelectieAutorisaties()) {
        final List<VerwerkPersoonResultaat> berichtenVoorAutorisatie = berichtenPerSelectietaak.get(selectieAutorisatie.getSelectietaakId());
        if (!berichtenVoorAutorisatie.isEmpty()) {
            final SelectieFragmentSchrijfBericht bericht =
                    maakSelectieFragmentSchrijfBericht(selectieTaak, selectieAutorisatie, berichtenVoorAutorisatie);
            schrijfTaken.add(bericht);
        }
    }
    //publiceer xml berichten naar schrijf node
    if (!schrijfTaken.isEmpty()) {
        selectieSchrijfTaakPublicatieService.publiceerSchrijfTaken(schrijfTaken);
    }
    return schrijfTaken.size();
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:23,代碼來源:VerwerkerPublicatieServiceImpl.java

示例7: mapSorteerAttributen

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
private void mapSorteerAttributen() {
    final Map<Integer, GroepElement> objectSorteerGroepTemp = Maps.newHashMap();
    final ArrayListMultimap<GroepElement, AttribuutElement> sorteerElementenVoorGroep = ArrayListMultimap.create();
    for (final AttribuutElement attribuutElement : idAttribuutMap.values()) {
        if (attribuutElement.getElement().getElementWaarde().getSorteervolgorde() != null) {
            objectSorteerGroepTemp.put(attribuutElement.getObjectType(), idGroepMap.get(attribuutElement.getGroepId()));
            sorteerElementenVoorGroep.put(idGroepMap.get(attribuutElement.getGroepId()), attribuutElement);
        }
    }
    objectSorteerGroepMap = ImmutableMap.copyOf(objectSorteerGroepTemp);
    final Map<GroepElement, List<AttribuutElement>> gesorteerdeElementenVoorGroepTemp = new HashMap<>();

    for (GroepElement groepElement : sorteerElementenVoorGroep.keySet()) {
        final List<AttribuutElement> sorteerAttributen = sorteerElementenVoorGroep.get(groepElement);
        sorteerAttributen.sort(
                Comparator.comparing(o -> o.getElement().getElementWaarde().getSorteervolgorde()));
        gesorteerdeElementenVoorGroepTemp.put(groepElement, sorteerAttributen);
    }
    sorteerAttributenVoorGroep = ImmutableMap.copyOf(gesorteerdeElementenVoorGroepTemp);
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:21,代碼來源:ElementHelper.java

示例8: RoundRobinOperator

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
public RoundRobinOperator(TunnelProvider tunnelProvider, OperatorContext context, RoundRobinSender config) throws OutOfMemoryException {
  super(config);
  this.config = config;
  this.allocator = context.getAllocator();
  this.handle = context.getFragmentHandle();
  this.stats = context.getStats();

  List<MinorFragmentEndpoint> destinations = config.getDestinations();
  final ArrayListMultimap<NodeEndpoint, Integer> dests = ArrayListMultimap.create();
  for(MinorFragmentEndpoint destination : destinations) {
    dests.put(destination.getEndpoint(), destination.getId());
  }

  this.tunnels = new ArrayList<>();
  this.minorFragments = new ArrayList<>();
  for(final NodeEndpoint ep : dests.keySet()){
    List<Integer> minorsList= dests.get(ep);
    minorFragments.add(minorsList);
    tunnels.add(tunnelProvider.getExecTunnel(ep));
  }

  int destCount = dests.keySet().size();
  this.currentTunnelsIndex = ThreadLocalRandom.current().nextInt(destCount);
  this.currentMinorFragmentsIndex = ThreadLocalRandom.current().nextInt(minorFragments.get(currentTunnelsIndex).size());
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:26,代碼來源:RoundRobinOperator.java

示例9: register

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
private <C,I> void register(Class<? extends I> clazz, ArrayListMultimap<String,Class<? extends I>> methods) {
  Description desc = clazz.getAnnotation(Description.class);
  String[] names;
  if (desc != null) {
    names = desc.name().split(",");
    for (int i=0; i<names.length; i++) {
      names[i] = names[i].trim();
    }
  }else{
    names = new String[]{clazz.getName().replace('.', '_')};
  }

  UDFType type = clazz.getAnnotation(UDFType.class);
  if (type != null && !type.deterministic()) {
    nonDeterministicUDFs.add(clazz);
  }


  for(int i=0; i<names.length;i++) {
    methods.put(names[i].toLowerCase(), clazz);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:23,代碼來源:HiveFunctionRegistry.java

示例10: getOutputFiles

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
@OutputFiles
public Map<String, File> getOutputFiles() {
    ArrayListMultimap<String, File> filesWithPotentialNameCollisions = ArrayListMultimap.create();
    for (Signature signature : getSignatures()) {
        String name = JAVA_PARTS.matcher(signature.getName()).replaceAll("_");
        if (name.length() > 0 && !Character.isJavaIdentifierStart(name.codePointAt(0))) {
            name = "_" + name.substring(1);
        }

        filesWithPotentialNameCollisions.put(name, signature.getToSign());
    }

    Map<String, File> files = Maps.newHashMap();
    for (Map.Entry<String, Collection<File>> entry : filesWithPotentialNameCollisions.asMap().entrySet()) {
        File[] filesWithSameName = entry.getValue().toArray(new File[0]);
        boolean hasMoreThanOneFileWithSameName = filesWithSameName.length > 1;
        for (int i = 0; i < filesWithSameName.length; i++) {
            File file = filesWithSameName[i];
            String key = entry.getKey();
            if (hasMoreThanOneFileWithSameName) {
                key += "$" + (i + 1);
            }
            files.put(key, file);
        }
    }

    return files;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:29,代碼來源:Sign.java

示例11: createSenderReceiverMapping

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
protected void createSenderReceiverMapping() {
  if (isSenderReceiverMappingCreated) {
    return;
  }

  senderToReceiverMapping = Maps.newHashMap();
  receiverToSenderMapping = ArrayListMultimap.create();

  // Find the list of sender fragment ids assigned to each Drillbit endpoint.
  ArrayListMultimap<DrillbitEndpoint, Integer> endpointSenderList = ArrayListMultimap.create();

  int senderFragmentId = 0;
  for(DrillbitEndpoint senderLocation : senderLocations) {
    endpointSenderList.put(senderLocation, senderFragmentId);
    senderFragmentId++;
  }

  int receiverFragmentId = 0;
  for(DrillbitEndpoint receiverLocation : receiverLocations) {
    List<Integer> senderFragmentIds = endpointSenderList.get(receiverLocation);

    for(Integer senderId : senderFragmentIds) {
      senderToReceiverMapping.put(senderId, new MinorFragmentEndpoint(receiverFragmentId, receiverLocation));

      receiverToSenderMapping.put(receiverFragmentId,
          new MinorFragmentEndpoint(senderId, senderLocations.get(senderId)));
    }
    receiverFragmentId++;
  }

  isSenderReceiverMappingCreated = true;
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:33,代碼來源:AbstractMuxExchange.java

示例12: createSenderReceiverMapping

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
protected void createSenderReceiverMapping() {
  if (isSenderReceiverMappingCreated) {
    return;
  }

  senderToReceiversMapping = ArrayListMultimap.create();
  receiverToSenderMapping = Maps.newHashMap();

  // Find the list of receiver fragment ids assigned to each Drillbit endpoint
  ArrayListMultimap<DrillbitEndpoint, Integer> endpointReceiverList = ArrayListMultimap.create();

  int receiverFragmentId = 0;
  for(DrillbitEndpoint receiverLocation : receiverLocations) {
    endpointReceiverList.put(receiverLocation, receiverFragmentId);
    receiverFragmentId++;
  }

  int senderFragmentId = 0;
  for(DrillbitEndpoint senderLocation : senderLocations) {
    final List<Integer> receiverMinorFragmentIds = endpointReceiverList.get(senderLocation);

    for(Integer receiverId : receiverMinorFragmentIds) {
      receiverToSenderMapping.put(receiverId, new MinorFragmentEndpoint(senderFragmentId, senderLocation));

      senderToReceiversMapping.put(senderFragmentId,
          new MinorFragmentEndpoint(receiverId, receiverLocations.get(receiverId)));
    }
    senderFragmentId++;
  }

  isSenderReceiverMappingCreated = true;
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:33,代碼來源:AbstractDeMuxExchange.java

示例13: BroadcastSenderRootExec

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
public BroadcastSenderRootExec(FragmentContext context,
                               RecordBatch incoming,
                               BroadcastSender config) throws OutOfMemoryException {
  super(context, context.newOperatorContext(config, null, false), config);
  this.ok = true;
  this.incoming = incoming;
  this.config = config;
  this.handle = context.getHandle();
  List<MinorFragmentEndpoint> destinations = config.getDestinations();
  ArrayListMultimap<DrillbitEndpoint, Integer> dests = ArrayListMultimap.create();

  for(MinorFragmentEndpoint destination : destinations) {
    dests.put(destination.getEndpoint(), destination.getId());
  }

  int destCount = dests.keySet().size();
  int i = 0;

  this.tunnels = new AccountingDataTunnel[destCount];
  this.receivingMinorFragments = new int[destCount][];
  for(final DrillbitEndpoint ep : dests.keySet()){
    List<Integer> minorsList= dests.get(ep);
    int[] minorsArray = new int[minorsList.size()];
    int x = 0;
    for(Integer m : minorsList){
      minorsArray[x++] = m;
    }
    receivingMinorFragments[i] = minorsArray;
    tunnels[i] = context.getDataTunnel(ep);
    i++;
  }
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:33,代碼來源:BroadcastSenderRootExec.java

示例14: populate

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
private void populate(List<PlanFragment> fragments){
  Map<NodeEndpoint, NodeTracker> trackers = new HashMap<>();
  Map<FragmentHandle, FragmentData> dataCollectors = new HashMap<>();
  ArrayListMultimap<Integer, FragmentData> majors = ArrayListMultimap.create();

  for(PlanFragment fragment : fragments) {
    final NodeEndpoint assignment = fragment.getAssignment();

    NodeTracker tracker = trackers.get(assignment);
    if (tracker == null) {
      tracker = new NodeTracker(assignment);
      trackers.put(assignment, tracker);
    }

    tracker.addFragment();
    FragmentData data = new FragmentData(fragment.getHandle(), assignment);
    dataCollectors.put(fragment.getHandle(), data);
    majors.put(fragment.getHandle().getMajorFragmentId(), data);
  }

  // Major fragments are required to be dense: numbered 0 through N-1
  MajorFragmentReporter[] tempReporters = new MajorFragmentReporter[majors.asMap().size()];
  for(Map.Entry<Integer, Collection<FragmentData>> e : majors.asMap().entrySet()) {
    Preconditions.checkElementIndex(e.getKey(), majors.asMap().size());
    Preconditions.checkState(tempReporters[e.getKey()] == null);
    tempReporters[e.getKey()] = new MajorFragmentReporter(e.getKey(), e.getValue());
  }

  this.reporters = ImmutableList.copyOf(tempReporters);
  this.nodeMap = ImmutableMap.copyOf(trackers);
  this.fragmentDataMap = ImmutableMap.copyOf(dataCollectors);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:33,代碼來源:QueryManager.java

示例15: createSenderReceiverMapping

import com.google.common.collect.ArrayListMultimap; //導入方法依賴的package包/類
protected void createSenderReceiverMapping() {
  if (isSenderReceiverMappingCreated) {
    return;
  }

  senderToReceiverMapping = Maps.newHashMap();
  receiverToSenderMapping = ArrayListMultimap.create();

  // Find the list of sender fragment ids assigned to each SabotNode endpoint.
  ArrayListMultimap<NodeEndpoint, Integer> endpointSenderList = ArrayListMultimap.create();

  int senderFragmentId = 0;
  for(NodeEndpoint senderLocation : senderLocations) {
    endpointSenderList.put(senderLocation, senderFragmentId);
    senderFragmentId++;
  }

  int receiverFragmentId = 0;
  for(NodeEndpoint receiverLocation : receiverLocations) {
    List<Integer> senderFragmentIds = endpointSenderList.get(receiverLocation);

    for(Integer senderId : senderFragmentIds) {
      senderToReceiverMapping.put(senderId, new MinorFragmentEndpoint(receiverFragmentId, receiverLocation));

      receiverToSenderMapping.put(receiverFragmentId,
          new MinorFragmentEndpoint(senderId, senderLocations.get(senderId)));
    }
    receiverFragmentId++;
  }

  isSenderReceiverMappingCreated = true;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:33,代碼來源:AbstractMuxExchange.java


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