java.util.LinkedHashSet.remove()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(248)

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

LinkedHashSet.remove介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-druid

@Override
 public boolean cancel(boolean interruptIfRunning)
 {
  synchronized (waitingFutures) {
   waitingFutures.remove(this);
  }
  return true;
 }
}

代码示例来源:origin: aws/aws-sdk-java

/**
   * Fluent method to remove the specified element from this set.
   */
  public FluentHashSet<E> delete(Object o) {
    super.remove(o);
    return this;
  }
}

代码示例来源:origin: apache/geode

/**
 * Caller must hold the rwLock
 */
@Override
protected boolean removeFromOtherLists(Long position) {
 return this.durableIDsList.remove(position);
}

代码示例来源:origin: loklak/loklak_server

public boolean remove(K key) {
  synchronized (this.set) {
    return this.set.remove(key);
  }
}

代码示例来源:origin: apache/drill

public void removeChild(MaterializedField field) {
 children.remove(field);
}

代码示例来源:origin: spotbugs/spotbugs

protected void removeChild(Matcher child) {
  children.remove(child);
}

代码示例来源:origin: apache/activemq

private void moveToNextFrequency(CacheNode<Key, Value> currentNode, int nextFrequency, LinkedHashSet<CacheNode<Key, Value>> currentNodes, LinkedHashSet<CacheNode<Key, Value>> newNodes) {
  currentNodes.remove(currentNode);
  newNodes.add(currentNode);
  currentNode.frequency = nextFrequency;
}

代码示例来源:origin: spotbugs/spotbugs

public void test3Bugs(LinkedHashSet<? extends CharSequence> set) {
  set.remove(Integer.valueOf(3));
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public boolean remove(Object o) {
  if (o instanceof byte[]) {
    delegate.remove(new ByteArrayWrapper((byte[]) o));
  }
  return delegate.remove(o);
}

代码示例来源:origin: pockethub/PocketHub

/**
 * Remove id from recent list
 *
 * @param id
 * @return this recent list
 */
public RecentRepositories remove(final long id) {
  if (ids == null) {
    load();
  }
  ids.remove(id);
  return this;
}

代码示例来源:origin: loklak/loklak_server

private void checkSize() {
  if (this.set.size() >= this.maxSize) {
    Iterator<K> i = this.set.iterator();
    while (i.hasNext() && this.set.size() > this.maxSize) this.set.remove(i.next());
  }
}

代码示例来源:origin: apache/incubator-gobblin

private boolean addRecordAndEvictIfNecessary(GlobalMetadata recordToAdd) {
 // First remove the element from the HashSet if it's already in there to reset
 // the 'LRU' piece; then add it back in
 boolean isNew = !metadataRecords.remove(recordToAdd);
 metadataRecords.add(recordToAdd);
 // Now remove the first element (which should be the oldest) from the list
 // if we've exceeded the cache size
 if (cacheSize != -1 && metadataRecords.size() > cacheSize) {
  Iterator<GlobalMetadata> recordIt = metadataRecords.iterator();
  recordIt.next(); // Remove the oldest element - don't care what it is
  recordIt.remove();
 }
 return isNew;
}

代码示例来源:origin: wildfly/wildfly

Supplier<String> doCreateSupplier(final LinkedHashSet<String> set, final SSLSession sslSession) {
  final Supplier<String> prevSupplier = prev.doCreateSupplier(set, sslSession);
  return () -> {
    final String name = prevSupplier.get();
    if (name != null) {
      return name;
    }
    if (set.remove(mechName)) {
      return mechName;
    }
    return null;
  };
}

代码示例来源:origin: spotbugs/spotbugs

public void forgetLastBug() {
  Data d = map.get(lastBug);
  if (d != null) {
    d.allSource.remove(lastSourceLine);
    if (d.allSource.isEmpty()) {
      map.remove(lastBug);
      hashes.remove(lastBug.getInstanceHash());
    }
  }
  lastBug = null;
  lastSourceLine = null;
}

代码示例来源:origin: apache/activemq

public Value remove(Object k) {
  CacheNode<Key, Value> currentNode = cache.remove(k);
  if (currentNode != null) {
    LinkedHashSet<CacheNode<Key, Value>> nodes = frequencyList[currentNode.frequency];
    nodes.remove(currentNode);
    if (lowestFrequency == currentNode.frequency) {
      findNextLowestFrequency();
    }
    return currentNode.v;
  } else {
    return null;
  }
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * After evicting or deleting or loading an entity, we don't
 * need to batch fetch it anymore, remove it from the queue
 * if necessary
 */
public void removeBatchLoadableEntityKey(EntityKey key) {
  if ( key.isBatchLoadable() ) {
    LinkedHashSet<EntityKey> set =  batchLoadableEntityKeys.get( key.getEntityName());
    if (set != null) {
      set.remove(key);
    }
  }
}

代码示例来源:origin: pockethub/PocketHub

/**
 * Add id to recent list
 *
 * @param id
 * @return this recent list
 */
public RecentRepositories add(final long id) {
  if (ids == null) {
    load();
  }
  ids.remove(id);
  ids.add(id);
  trim();
  return this;
}

代码示例来源:origin: loklak/loklak_server

public boolean contains(K key) {
  synchronized (this.set) {
    // we remove the value to add it again at the end of the list
    if (!this.set.remove(key)) {
      this.stats.miss();
      return false; // in case that the entry does not exist we are ready here
    }
    
    // the new entry gets to the end of the list
    this.set.add(key);
  }
  this.stats.hit();
  return true;
}

代码示例来源:origin: loklak/loklak_server

public boolean add(K key) {
  boolean oldval;
  synchronized (this.set) {
    // make room; this may remove entries from the beginning of the list
    checkSize();
    
    // we remove the value first to ensure that the value gets at the end of the list
    oldval = this.set.remove(key);
    
    // the new value gets to the end of the list
    this.set.add(key);
  }
  this.stats.update();
  return oldval;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void removePerspective( SpoonPerspective per ) {
 perspectives.remove( per );
 orderedPerspectives.remove( per );
 Document document = domContainer.getDocumentRoot();
 XulComponent comp = document.getElementById( "perspective-" + per.getId() );
 comp.getParent().removeChild( comp );
 comp = document.getElementById( "perspective-btn-" + per.getId() );
 comp.getParent().removeChild( comp );
 XulToolbar mainToolbar = (XulToolbar) domContainer.getDocumentRoot().getElementById( "main-toolbar" );
 ( (Composite) mainToolbar.getManagedObject() ).layout( true, true );
 deck.setSelectedIndex( 0 );
}

相关文章