Tabnine Logo
HashSet.remove
Code IndexAdd Tabnine to your IDE (free)

How to use
remove
method
in
java.util.HashSet

Best Java code snippets using java.util.HashSet.remove (Showing top 20 results out of 10,440)

Refine searchRefine arrow

  • HashSet.add
  • HashSet.contains
  • Iterator.next
  • HashSet.isEmpty
origin: opentripplanner/OpenTripPlanner

  public void setMonitoring(String key, boolean on) {
    if (on) {
      monitoring.add(key);
    } else {
      monitoring.remove(key);
    }
  }
}
origin: loklak/loklak_server

@Override
public String getQuery() {
  String query = this.queries.iterator().next();
  this.queries.remove(query);
  return query;
}
origin: robolectric/robolectric

@Implementation(minSdk = LOLLIPOP)
protected void removeDefaultNetworkActiveListener(ConnectivityManager.OnNetworkActiveListener l) {
 if (l == null) {
  throw new IllegalArgumentException("Invalid OnNetworkActiveListener");
 }
 if (onNetworkActiveListeners.contains(l)) {
  onNetworkActiveListeners.remove(l);
 }
}
origin: apache/geode

Iterator iterGrantorSerialNumbers = rmtGrantorSerialNumbers.iterator();
while (iterGrantorServices.hasNext()) {
 String serviceName = (String) iterGrantorServices.next();
 long versionId = ((Long) iterGrantorVersions.next()).longValue();
 int serialNumber = ((Integer) iterGrantorSerialNumbers.next()).intValue();
 GrantorInfo oldgi = (GrantorInfo) this.grantors.get(serviceName);
 if (oldgi == null || oldgi.getVersionId() < versionId) {
  this.grantors.put(serviceName, new GrantorInfo(rmtId, versionId, serialNumber, false));
  this.crashedGrantors.remove(serviceName);
 String serviceName = (String) it.next();
 if (!this.grantors.containsKey(serviceName)) {
  this.crashedGrantors.add(serviceName);
origin: stackoverflow.com

 outEdges.add(e);
 node.inEdges.add(e);
 return this;
for(Node n : allNodes){
 if(n.inEdges.size() == 0){
  S.add(n);
while(!S.isEmpty()){
 Node n = S.iterator().next();
 S.remove(n);
  Edge e = it.next();
  Node m = e.to;
  m.inEdges.remove(e);//Remove edge from m
  if(m.inEdges.isEmpty()){
   S.add(m);
 if(!n.inEdges.isEmpty()){
  cycle = true;
  break;
origin: Sable/soot

Object s = it.next();
changedUnitsSet.remove(s);
  Object obj = predIt.next();
   JPegStmt stmt = (JPegStmt) predIt.next();
   if (stmt.equals(obj)) {
  Object succ = succIt.next();
  if (!changedUnitsSet.contains(succ)) {
   changedUnits.addLast(succ);
   changedUnitsSet.add(succ);
origin: apache/activemq

HashSet<String> hs = sd.ackPositions.get(sequenceId);
if (hs != null) {
  hs.remove(subscriptionKey);
  if (hs.isEmpty()) {
    HashSet<String> firstSet = sd.ackPositions.values().iterator().next();
    sd.ackPositions.remove(sequenceId);
        Entry<Long, MessageRecord> entry = iterator.next();
        if (entry.getKey().compareTo(sequenceId) <= 0) {
origin: Sable/soot

Iterator keyIt = keylist.iterator();
while (keyIt.hasNext()) {
 Object key = keyIt.next();
 if (key instanceof ArrayRef) {
  outset.remove(key);
 Iterator keyIt = keylist.iterator();
 while (keyIt.hasNext()) {
  Object key = keyIt.next();
  if (key instanceof ArrayRef) {
   Value base = ((ArrayRef) key).getBase();
    outset.remove(key);
    Object base = ((Array2ndDimensionSymbol) key).getVar();
    if (base.equals(local)) {
     outset.remove(key);
Iterator condIt = condset.iterator();
while (condIt.hasNext()) {
 if (inset.contains(condIt.next())) {
  outset.addAll(genset);
  break;
origin: greenrobot/essentials

@Override
public void run() {
  final HashSet<Long> set = new HashSet<>(initialCapacity);
  final long[] values = this.values;
  for (int i = 0; i < N; i++) {
    set.add(values[i]);
  }
  // check contains on every second key and remove it
  for (int i = 0; i < N; i++) {
    final long key = values[i] + i % 2;
    if (set.contains(key)) {
      set.remove(key);
    }
  }
  // remove the rest
  for (int i = 0; i < N; i++) {
    final long key = values[i];
    if (set.contains(key)) {
      set.remove(key);
    }
  }
}
origin: ankidroid/Anki-Android

private void onCheck(int position, View cell) {
  CheckBox checkBox = (CheckBox) cell.findViewById(R.id.card_checkbox);
  if (checkBox.isChecked()) {
    mCheckedCardPositions.add(position);
  } else {
    mCheckedCardPositions.remove(position);
  }
  updateMultiselectMenu();
  if (mCheckedCardPositions.isEmpty()) {
    // when 0 are selected: end selection mode
    endMultiSelectMode();
  } else {
    mActionBarTitle.setText(Integer.toString(mCheckedCardPositions.size()));
  }
}
origin: fesh0r/fernflower

setHandlers.add(head);
while (true) {
  if (setNodes.contains(handler)) {
   continue;
    Statement st = lstStack.remove(0);
    if (!(setNodes.contains(st) || (!same && st == post))) {
     setNodes.add(st);
     if (st != head) {
   setHandlers.remove(handler);
   break;
origin: fesh0r/fernflower

public HashSet<Statement> buildContinueSet() {
 continueSet.clear();
 for (Statement st : stats) {
  continueSet.addAll(st.buildContinueSet());
  if (st != first) {
   continueSet.remove(st.getBasichead());
  }
 }
 for (StatEdge edge : getEdges(StatEdge.TYPE_CONTINUE, DIRECTION_FORWARD)) {
  continueSet.add(edge.getDestination().getBasichead());
 }
 if (type == TYPE_DO) {
  continueSet.remove(first.getBasichead());
 }
 return continueSet;
}
origin: apache/mahout

switch (randomFrom(ops)) {
 case ADD:
  assertEquals(reference.add(k), base.add(k));
  break;
  assertEquals(reference.remove(k), base.remove(k));
  break;
  assertEquals(reference.contains(k), base.contains(k));
  break;
  assertEquals(reference.isEmpty(), base.isEmpty());
  break;
origin: apache/kylin

private void closeReader(Reader r) throws IOException {
  synchronized (lock) {
    if (activeReaders.contains(r) == false)
      throw new IllegalStateException();
    activeReaders.remove(r);
    if (activeReaders.isEmpty())
      closeReadChannel();
  }
}
origin: com.h2database/h2

@Override
public void unlock(Session s) {
  if (database != null) {
    traceLock(s, lockExclusiveSession == s, "unlock");
    if (lockExclusiveSession == s) {
      lockExclusiveSession = null;
    }
    synchronized (database) {
      if (!lockSharedSessions.isEmpty()) {
        lockSharedSessions.remove(s);
      }
      if (!waitingSessions.isEmpty()) {
        database.notifyAll();
      }
    }
  }
}
origin: naman14/Timber

uniqueIds.add(ids[0]);
selection.append(ids[0]);
  if (uniqueIds.add(ids[i])) {
      uniqueIds.remove(id);
    } while (topSongsCursor.moveToNext());
  sortedList[idx++] = iter.next();
origin: hibernate/hibernate-orm

@Override
public Object removeEntity(EntityKey key) {
  final Object entity = entitiesByKey.remove( key );
  final Iterator itr = entitiesByUniqueKey.values().iterator();
  while ( itr.hasNext() ) {
    if ( itr.next() == entity ) {
      itr.remove();
    }
  }
  // Clear all parent cache
  parentsByChild.clear();
  entitySnapshotsByKey.remove( key );
  nullifiableEntityKeys.remove( key );
  if( batchFetchQueue != null ) {
    getBatchFetchQueue().removeBatchLoadableEntityKey(key);
    getBatchFetchQueue().removeSubselect(key);
  }
  return entity;
}
origin: Sable/soot

if (t instanceof AnySubType) {
 HashSet<SootClass> s = new HashSet<SootClass>();
 s.add(declaringClass);
 while (!s.isEmpty()) {
  SootClass c = s.iterator().next();
  s.remove(c);
  if (!c.isInterface() && !c.isAbstract() && canStoreClass(c, declaringClass)) {
   SootMethod concreteM = resolveConcreteDispatch(c, m);
origin: apache/storm

Iterator<TopoProfileAction> iter = mod.iterator();
while (iter.hasNext()) {
  TopoProfileAction action = iter.next();
  if (!action.topoId.equals(dynamicState.currentAssignment.get_topology_id())) {
    iter.remove();
    if (modPending.contains(action)) {
      boolean isTimeForStop = Time.currentTimeMillis() > action.request.get_time_stamp();
      if (isTimeForStop) {
          LOG.debug("Stopped {} action finished", action);
          iter.remove();
          modPending.remove(action);
        } else {
          LOG.warn("Stopping {} failed, will be retried", action);
          modPending.add(action);
          LOG.debug("Started {} now: {}", action, Time.currentTimeMillis());
        } else {
origin: apache/zookeeper

candidates.remove(self.getId()); // if we're here, I shouldn't be the leader
long curCandidate = candidates.iterator().next();
Proposal p = outstandingProposals.get(curZxid);
while (p!=null && !candidates.isEmpty()) {
  for (Proposal.QuorumVerifierAcksetPair qvAckset: p.qvAcksetPairs){
    if (candidates.isEmpty()) return curCandidate;
    curCandidate = candidates.iterator().next();
    if (candidates.size() == 1) return curCandidate;
java.utilHashSetremove

Javadoc

Removes the specified object from this HashSet.

Popular methods of HashSet

  • <init>
  • add
    Adds the specified element to this set if it is not already present. More formally, adds the specifi
  • contains
    Returns true if this set contains the specified element. More formally, returns true if and only if
  • size
    Returns the number of elements in this set (its cardinality).
  • addAll
  • iterator
    Returns an iterator over the elements in this set. The elements are returned in no particular order.
  • isEmpty
    Returns true if this set contains no elements.
  • clear
    Removes all of the elements from this set. The set will be empty after this call returns.
  • toArray
  • removeAll
  • equals
  • clone
    Returns a shallow copy of this HashSet instance: the elements themselves are not cloned.
  • equals,
  • clone,
  • retainAll,
  • stream,
  • containsAll,
  • forEach,
  • hashCode,
  • toString,
  • removeIf

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • scheduleAtFixedRate (Timer)
  • setScale (BigDecimal)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JLabel (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now