java类com.google.common.collect.HashMultimap的实例源码

ItemStack.java 文件源码 项目:DecompiledMinecraft 阅读 32 收藏 0 点赞 0 评论 0
public Multimap<String, AttributeModifier> getAttributeModifiers()
{
    Multimap<String, AttributeModifier> multimap;

    if (this.hasTagCompound() && this.stackTagCompound.hasKey("AttributeModifiers", 9))
    {
        multimap = HashMultimap.<String, AttributeModifier>create();
        NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            AttributeModifier attributemodifier = SharedMonsterAttributes.readAttributeModifierFromNBT(nbttagcompound);

            if (attributemodifier != null && attributemodifier.getID().getLeastSignificantBits() != 0L && attributemodifier.getID().getMostSignificantBits() != 0L)
            {
                multimap.put(nbttagcompound.getString("AttributeName"), attributemodifier);
            }
        }
    }
    else
    {
        multimap = this.getItem().getItemAttributeModifiers();
    }

    return multimap;
}
PostProcessManifestAction.java 文件源码 项目:atlas 阅读 30 收藏 0 点赞 0 评论 0
private Multimap<String, File> getLibManifestDepenendyMap() {
    Multimap<String, File> maps = HashMultimap.create();
    List<? extends AndroidLibrary> libs = getAwbLibraries();
    if (libs == null || libs.isEmpty()) {
        return maps;
    }

    for (AndroidLibrary mdi : libs) {
        for (AndroidLibrary childLib : mdi.getLibraryDependencies()) {
            ((HashMultimap<String, File>)maps).put(mdi.getName(), childLib.getManifest());
        }
    }

    return maps;
}
Vpls.java 文件源码 项目:athena 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Computes the list of configured interfaces with a VLAN Id.
 *
 * @return the interfaces grouped by vlan id
 */
protected SetMultimap<VlanId, ConnectPoint> getConfigCPoints() {
    log.debug("Checking interface configuration");

    SetMultimap<VlanId, ConnectPoint> confCPointsByVlan =
            HashMultimap.create();

    interfaceService.getInterfaces()
            .stream()
            .filter(intf -> intf.ipAddressesList().isEmpty())
            .forEach(intf -> confCPointsByVlan.put(intf.vlan(),
                                                   intf.connectPoint()));
    return confCPointsByVlan;
}
Vpls.java 文件源码 项目:athena 阅读 32 收藏 0 点赞 0 评论 0
/**
 * Checks if for any ConnectPoint configured there's an host present
 * and in case it associate them together.
 *
 * @param confCPointsByVlan the configured ConnectPoints grouped by vlan id
 * @return the configured ConnectPoints with eventual hosts associated.
 */
protected SetMultimap<VlanId, Pair<ConnectPoint, MacAddress>> pairAvailableHosts(
        SetMultimap<VlanId, ConnectPoint> confCPointsByVlan) {
    log.debug("Binding connected hosts mac addresses");

    SetMultimap<VlanId, Pair<ConnectPoint, MacAddress>> confHostPresentCPoint =
            HashMultimap.create();

    confCPointsByVlan.entries()
            .forEach(e -> bindMacAddr(e, confHostPresentCPoint));

    return confHostPresentCPoint;
}
TestShortCircuitCache.java 文件源码 项目:hadoop 阅读 40 收藏 0 点赞 0 评论 0
static private void checkNumberOfSegmentsAndSlots(final int expectedSegments,
      final int expectedSlots, ShortCircuitRegistry registry) {
  registry.visit(new ShortCircuitRegistry.Visitor() {
    @Override
    public void accept(HashMap<ShmId, RegisteredShm> segments,
                       HashMultimap<ExtendedBlockId, Slot> slots) {
      Assert.assertEquals(expectedSegments, segments.size());
      Assert.assertEquals(expectedSlots, slots.size());
    }
  });
}
NotificationPreferencesServiceImpl.java 文件源码 项目:Equella 阅读 24 收藏 0 点赞 0 评论 0
private Multimap<String, String> asMultiMap(Map<String, String> allWatched) {
    Multimap<String, String> colMap = HashMultimap.create();
    for( Entry<String, String> entry : allWatched.entrySet() )
    {
        String pref = entry.getValue();
        String userId = entry.getKey();
        Set<String> colUuids = getCollectionsFromPref(pref);
        for( String colUuid : colUuids )
        {
            colMap.put(colUuid, userId);
        }
    }
    return colMap;
}
BlockPotStill.java 文件源码 项目:Thermionics 阅读 32 收藏 0 点赞 0 评论 0
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
    Multimap<String, AttributeModifier> modifiers = HashMultimap.create();
    if (slot==EntityEquipmentSlot.HEAD) {
        modifiers.put(
                SharedMonsterAttributes.ARMOR.getName(),
                new AttributeModifier(UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150"), "Armor modifier", 3D, 0)
                );

    }

    return modifiers;
}
GrayReleaseRulesHolder.java 文件源码 项目:apollo-custom 阅读 31 收藏 0 点赞 0 评论 0
public GrayReleaseRulesHolder() {
  loadVersion = new AtomicLong();
  grayReleaseRuleCache = Multimaps.synchronizedSetMultimap(HashMultimap.create());
  reversedGrayReleaseRuleCache = Multimaps.synchronizedSetMultimap(HashMultimap.create());
  executorService = Executors.newScheduledThreadPool(1, ApolloThreadFactory
      .create("GrayReleaseRulesHolder", true));
}
ItemStack.java 文件源码 项目:BaseClient 阅读 35 收藏 0 点赞 0 评论 0
public Multimap<String, AttributeModifier> getAttributeModifiers()
{
    Multimap<String, AttributeModifier> multimap;

    if (this.hasTagCompound() && this.stackTagCompound.hasKey("AttributeModifiers", 9))
    {
        multimap = HashMultimap.<String, AttributeModifier>create();
        NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            AttributeModifier attributemodifier = SharedMonsterAttributes.readAttributeModifierFromNBT(nbttagcompound);

            if (attributemodifier != null && attributemodifier.getID().getLeastSignificantBits() != 0L && attributemodifier.getID().getMostSignificantBits() != 0L)
            {
                multimap.put(nbttagcompound.getString("AttributeName"), attributemodifier);
            }
        }
    }
    else
    {
        multimap = this.getItem().getItemAttributeModifiers();
    }

    return multimap;
}
RemoteSdk.java 文件源码 项目:javaide 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Fetches the remote list of packages.
 * <p/>
 * This respects the settings from the {@link SettingsController} which
 * dictates whether the {@link DownloadCache} is used and whether HTTP
 * is enforced over HTTPS.
 * <p/>
 * The call may block on network access. Callers will likely want to invoke this
 * from a thread and make sure the logger is thread-safe with regard to UI updates.
 *
 * @param sources The sources to download from.
 * @param logger A logger to report status & progress.
 * @return A non-null map of {@link PkgType} to {@link RemotePkgInfo}
 *         describing the remote packages available for install/download.
 */
@NonNull
public Multimap<PkgType, RemotePkgInfo> fetch(@NonNull SdkSources sources,
                                              @NonNull ILogger logger) {
    Multimap<PkgType, RemotePkgInfo> remotes = HashMultimap.create();

    boolean forceHttp = mSettingsController.getSettings().getForceHttp();

    // Implementation detail: right now this reuses the SdkSource(s) classes
    // from the sdk-repository v2. The problem with that is that the sources are
    // mutable and hold the fetch logic and hold the packages array.
    // Instead I'd prefer to have the sources be immutable descriptors and move
    // the fetch logic here. Eventually my goal is to get rid of them
    // and include the logic directly here instead but for right now lets
    // just start with what we have to avoid implementing it all at once.
    // It does mean however that this code needs to convert the old Package
    // type into the new RemotePkgInfo type.

    for (SdkSource source : sources.getAllSources()) {
        source.load(getDownloadCache(),
                    new NullTaskMonitor(logger),
                    forceHttp);
        Package[] pkgs = source.getPackages();
        if (pkgs == null || pkgs.length == 0) {
            continue;
        }

        // Adapt the legacy Package instances into the new RemotePkgInfo
        for (Package p : pkgs) {
            IPkgDesc d = p.getPkgDesc();
            RemotePkgInfo r = new RemotePkgInfo(d, source);
            remotes.put(d.getType(), r);
        }
    }

    return remotes;
}


问题


面经


文章

微信
公众号

扫码关注公众号