gnu.trove.map.TObjectIntMap.containsKey()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中gnu.trove.map.TObjectIntMap.containsKey()方法的一些代码示例,展示了TObjectIntMap.containsKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TObjectIntMap.containsKey()方法的具体详情如下:
包路径:gnu.trove.map.TObjectIntMap
类名称:TObjectIntMap
方法名:containsKey

TObjectIntMap.containsKey介绍

[英]Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)
[中]如果此映射包含指定键的映射,则返回true。更正式地说,当且仅当此映射包含一个键k的映射,使得(键==null?k==null:key.equals(k))返回true。(最多可以有一个这样的映射。)

代码示例

代码示例来源:origin: alibaba/mdrill

/**
 * Checks for the present of <tt>key</tt> in the keys of the map.
 *
 * @param key an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean containsKey( Object key ) {
  return _map.containsKey( key );
}

代码示例来源:origin: alibaba/mdrill

public boolean containsKey( Object key ) {
  synchronized( mutex ) { return m.containsKey( key ); }
}
public boolean containsValue( int value ){

代码示例来源:origin: alibaba/mdrill

public boolean containsKey( Object key ){ return m.containsKey( key ); }
public boolean containsValue( int val ) { return m.containsValue( val ); }

代码示例来源:origin: MovingBlocks/Terasology

private int getTileIndex(ResourceUrn uri, boolean warnOnError) {
  if (tileIndexes.containsKey(uri)) {
    return tileIndexes.get(uri);
  }
  if (warnOnError) {
    logger.warn("Tile {} could not be resolved", uri);
  }
  return 0;
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

/**
 * Build the ID - Index map if needed.
 */
private synchronized void buildIdIndexMapIfNeeded () {
  // we check again if the map has been built. It's possible that it would have been built
  // by this method in another thread while this instantiation was blocked.
  if (idIndexMap == null) {
    // make a local object, don't expose to public view until it's built
    TObjectIntMap idIndexMap = new TObjectIntHashMap<String>(this.capacity, 1f, -1);
    
    for (int i = 0; i < this.capacity; i++) {
      if (ids[i] != null) {
        if (idIndexMap.containsKey(ids[i])) {
          LOG.error("Duplicate ID {} in pointset.", ids[i]);
        }
        else {   
          idIndexMap.put(ids[i], i);
        }
      }
    }
    // now expose to public view; reference assignment is an atomic operation
    this.idIndexMap = idIndexMap;
  }
}

代码示例来源:origin: MovingBlocks/Terasology

private int getUniformLocation(int activeShaderProgramId, String desc) {
  UniformId id = new UniformId(activeShaderProgramId, desc);
  if (uniformLocationMap.containsKey(id)) {
    return uniformLocationMap.get(id);
  }
  int loc = GL20.glGetUniformLocation(activeShaderProgramId, desc);
  uniformLocationMap.put(id, loc);
  return loc;
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

@Override public void visitVertex(State state) {
    Vertex vertex = state.getVertex();
    if (vertex instanceof TransitStop) {
      Stop stop = ((TransitStop)vertex).getStop();
      if (stopsFound.containsKey(stop)) return; // record only the closest stop in each cluster
      stopsFound.put(stop, (int) state.getElapsedTimeSeconds());
    }
  }
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
public void setTexture(String desc, Texture texture) {
  if (isDisposed()) {
    return;
  }
  int texId;
  if (bindMap.containsKey(desc)) {
    texId = bindMap.get(desc);
  } else {
    // TODO: do this initially, and try and have similar textures in similar slots for all materials.
    ShaderParameterMetadata metadata = shader.getParameter(desc);
    if (metadata == null || !metadata.getType().isTexture()) {
      return;
    }
    texId = textureIndex++;
    // Make sure to bind the texture for all permutations
    setInt(desc, texId);
    bindMap.put(desc, texId);
  }
  textureMap.put(texId, texture);
}

代码示例来源:origin: alibaba/mdrill

if ( value == no_entry_value ) {
  if ( !( that.get( key ) == that.getNoEntryValue() &&
    that.containsKey( key ) ) ) {

代码示例来源:origin: alibaba/mdrill

if ( value == no_entry_value ) {
  if ( !( that.get( key ) == that.getNoEntryValue() &&
    that.containsKey( key ) ) ) {

代码示例来源:origin: SpigotMC/BungeeCord

final int getId(Class<? extends DefinedPacket> packet, int version)
  {
    ProtocolData protocolData = getProtocolData( version );
    if ( protocolData == null )
    {
      throw new BadPacketException( "Unsupported protocol version" );
    }
    Preconditions.checkArgument( protocolData.packetMap.containsKey( packet ), "Cannot get ID for packet %s in phase %s with direction %s", packet, protocolPhase, direction );
    return protocolData.packetMap.get( packet );
  }
}

代码示例来源:origin: net.sf.trove4j/trove4j

/**
 * Checks for the present of <tt>key</tt> in the keys of the map.
 *
 * @param key an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean containsKey( Object key ) {
  return _map.containsKey( key );
}

代码示例来源:origin: com.flowpowered/caustic-api

/**
 * Returns true if an attribute has the provided name.
 *
 * @param name The name to lookup
 * @return Whether or not an attribute possesses the name
 */
public boolean hasAttribute(String name) {
  return nameToIndex.containsKey(name);
}

代码示例来源:origin: com.palantir.patches.sourceforge/trove3

@Override
public boolean containsKey( Object key ) {
  synchronized( mutex ) { return m.containsKey( key ); }
}
@Override

代码示例来源:origin: com.palantir.patches.sourceforge/trove3

/**
 * Checks for the present of <tt>key</tt> in the keys of the map.
 *
 * @param key an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
@Override
public boolean containsKey( Object key ) {
  return _map.containsKey( key );
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public int getRegistrationID(Class<? extends RemoteYoGraphic> clazz)
{
 if (!registrationIDs.containsKey(clazz))
   throw new RuntimeException("The class: " + clazz.getSimpleName() + " is not registered.");
 return registrationIDs.get(clazz);
}

代码示例来源:origin: org.btrplace/scheduler-choco

private int consumption(VM v, int a) {
  if (wantedAmount.containsKey(v)) {
    return Math.max(a, wantedAmount.get(v));
  }
  return a;
}

代码示例来源:origin: de.unijena.bioinf.phylo/mincut

@Override
public boolean add(E item) {
  if (idx.containsKey(item)) {
    return false;
  }
  idx.put(item, dta.size());
  dta.add(item);
  return true;
}

代码示例来源:origin: org.btrplace/scheduler-choco

private int capacity(Node n, int a) {
  if (wantedCapacity.containsKey(n)) {
    return Math.max(a, wantedCapacity.get(n));
  }
  return a;
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public <T extends RemoteYoGraphic> void registerBuilder(Class<T> clazz, YoGraphicFromMessageBuilder<T> builder)
{
 int id = clazz.getName().hashCode();
 if (registrationIDs.containsKey(clazz))
   throw new RuntimeException("The class: " + clazz.getSimpleName() + " has already been registered.");
 classList.add(clazz);
 registrationIDs.put(clazz, id);
 registrationClasses.put(id, clazz);
 registrationBuilders.put(id, builder);
}

相关文章