Set remove - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Set remove method.

This code example shows how to use the following methods:remove
  public void add(T elem) {
    ids.add(elem);
  } 
 
  public void remove(T elem) {
    ids.remove(elem);
  } 
 
  public void merge(ChoosableSet<T> toMerge) {
    ids.addAll(toMerge.ids);
  } 
 
  public boolean isEmpty() { 
    return ids.isEmpty();
  } 
 
  @Override 
  public Iterator<T> iterator() {
    return ids.iterator();
  } 
7
CodeRank
This code example shows how to use the following methods:remove
            return next;
        } 
 
        @Override 
        public synchronized void freeBatchId(int id) {
            ids.remove(id);
        } 
 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:contains, remove
        } 
    } 
 
    public synchronized void undeploy(@Observes BeforeStop event, Container container, ServiceArchiveHolder archiveHolder) {
        // clean up if we deployed to this container? 
        if (serviceArchiveDeployed.contains(container.getName())) {
            try { 
                Archive<?> serviceArchive = archiveHolder.getArchive();
                log.infof("Undeploy arquillian service: %s", serviceArchive);
                DeployableContainer<?> deployableContainer = container.getDeployableContainer();
                deployableContainer.undeploy(serviceArchive);
                serviceArchiveDeployed.remove(container.getName());
            } catch (Throwable th) {
                log.error("Cannot undeploy arquillian service", th);
            } 
        } 
    } 
} 
8
CodeRank
This code example shows how to use the following methods:isEmpty, remove
  @Lock({Queue.class, SchedulerApplicationAttempt.class}) 
  synchronized public void deactivateApplication( 
      String user, ApplicationId applicationId) {
    Set<ApplicationId> userApps = usersApplications.get(user);
    if (userApps != null) {
      if (userApps.remove(applicationId)) {
        metrics.deactivateApp(user);
      } 
      if (userApps.isEmpty()) {
        usersApplications.remove(user);
        --activeUsers;
        metrics.decrActiveUsers();
        LOG.debug("User " + user + " removed from activeUsers, currently: " + 
            activeUsers);
      } 
    } 
  } 
   
  /** 
   * Get number of active users i.e. users with applications which have pending 
7
CodeRank
This code example shows how to use the following methods:add, contains, remove
      return super.getResult(); 
    } 
  } 
 
  private static void addItemToResult(Object o, Set<Object> accepted, Set<Object> rejected) {
    if (!accepted.contains(o) && !rejected.contains(o)) {
      accepted.add(o);
    } else { 
      accepted.remove(o);
      rejected.add(o);
    } 
  } 
 
  private static void addItemsToResult(Collection<Object> co, Set<Object> accepted, Set<Object> rejected) {
    for (Object o : co) {
      addItemToResult(o, accepted, rejected);
    } 
  } 
 
  public String getSyntax() {
8
CodeRank
This code example shows how to use the following methods:remove
    } 
 
    protected StringBuilder undeploy(StringBuilder buf, String deployment, String sg) {
        ctx.handleSafe("undeploy --server-groups=" + sg + ' ' + deployment);
        if(ctx.getExitCode() == 0) {
            if(!afterTestDeployments.remove(deployment)) {
                if(buf == null) {
                    buf = new StringBuilder();
                    buf.append("Undeployed unexpected content: ");
                    buf.append(deployment);
                } else { 
                    buf.append(", ").append(deployment);
                } 
            } 
        } 
        return buf;
    } 
 
    @Test 
    public void testUndeployAllWars() throws Exception { 
6
CodeRank
This code example shows how to use the following methods:remove
	 */ 
	public CellNote removeNumber(int number) {
		if (number < 1 || number > 9)
			throw new IllegalArgumentException("Number must be between 1-9.");
 
		Set<Integer> notedNumbers = new HashSet<Integer>(getNotedNumbers());
		notedNumbers.remove(number);
 
		return new CellNote(notedNumbers);
	} 
 
	public CellNote clear() { 
		return new CellNote(); 
	} 
 
	/** 
	 * Returns true, if note is empty. 
	 * 
	 * @return True if note is empty. 
	 */ 
6
CodeRank
This code example shows how to use the following methods:contains, remove
    void unselect(long handle) {
        boolean wasSelected = isSelected(handle);
        if (!wasSelected) {
            return; 
        } 
        selection.remove(handle);
        if (getSelectionCount() == 0) { 
            finishActionMode(); 
            return; 
        } 
        owner.notifyDataSetChanged();
        onItemSelectedStateChanged(); 
    } 
 
    Set<Long> getSelection() {
        // Return a copy to prevent concurrent modification problems 
        return new HashSet<Long>(selection);
    } 
 
    int getSelectionCount() { 

6
CodeRank
This code example shows how to use the following methods:remove
    underlying.add(OObjectEntitySerializer.serializeFieldValue(deserializeClass, e));
    return super.add(e);
  } 
 
  public boolean remove(final Object e) {
    underlying.remove(OObjectEntitySerializer.serializeFieldValue(deserializeClass, e));
    return super.remove(e);
  } 
 
  public boolean containsAll(final Collection<?> c) {
    for (Object o : c)
      if (!super.contains(o) && !underlying.contains(OObjectEntitySerializer.serializeFieldValue(deserializeClass, o)))
        return false; 
 
    return true; 
  } 
 
  public boolean addAll(final Collection<? extends TYPE> c) {
    boolean modified = false;
    setDirty(); 
7
CodeRank
This code example shows how to use the following methods:remove
	} 
	 
	public void removeFakeCommand(String command)
	{ 
		LOG.info("Command (" + command + ") will not be faked anymore !!");
		_commandsToFake.remove(USE_FAKE_COMMAND);
	} 
	 
	@Override 
	public DatabusRequest process(DatabusRequest request) throws IOException,
			RequestProcessingException, DatabusException  
	{ 
		String command = request.getName();
		 
		if ( command.equalsIgnoreCase(USE_FAKE_COMMAND))
		{ 
			String cmd = request.getRequiredStringParam(COMMAND_KEY_NAME);
			addCommandsToFake(cmd);
			String result = "{ \"fake\": \"true\", \"command\" : \"" + cmd + "\", \"result\" : \"true\" }";			
			request.getResponseContent().write(ByteBuffer.wrap(result.getBytes()));
6
CodeRank
remove Method Overview
Removes the specified element from this set if it is present (optional operation).
See Code Examples for other Java 8 Set Methods: