Example usage for org.apache.commons.collections4 MultiValuedMap removeMapping

List of usage examples for org.apache.commons.collections4 MultiValuedMap removeMapping

Introduction

In this page you can find the example usage for org.apache.commons.collections4 MultiValuedMap removeMapping.

Prototype

boolean removeMapping(Object key, Object item);

Source Link

Document

Removes a key-value mapping from the map.

Usage

From source file:com.evolveum.midpoint.task.quartzimpl.work.workers.WorkersManager.java

/**
 * The easiest step: we just match current workers with the 'should be' state. Matching items are deleted from both sides.
 *//*  w w w .  j ava  2s  . c  o m*/
private int matchWorkers(List<Task> currentWorkers, MultiValuedMap<String, WorkerKey> shouldBeWorkers) {
    int count = 0;
    for (Task currentWorker : new ArrayList<>(currentWorkers)) {
        WorkerKey currentWorkerKey = new WorkerKey(currentWorker);
        if (shouldBeWorkers.containsValue(currentWorkerKey)) {
            shouldBeWorkers.removeMapping(currentWorkerKey.group, currentWorkerKey);
            currentWorkers.remove(currentWorker);
            count++;
        }
    }
    LOGGER.trace("After matchWorkers (result: {}):\nCurrent workers: {}\nShould be workers: {}", count,
            currentWorkers, shouldBeWorkers);
    return count;
}