Remove the oldest signedPreKey until there are only MAX_NUMBER_OF_STORED_SIGNED_PREKEYS left.

@param userDevice our OmemoDevice.
199032
private void removeOldSignedPreKeys(OmemoDevice userDevice) {
        if (OmemoConfiguration.getMaxNumberOfStoredSignedPreKeys() <= 0) {
            return;
        }

        TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);

        for (int i = 0; i < signedPreKeys.keySet().size() - OmemoConfiguration.getMaxNumberOfStoredSignedPreKeys(); i++) {
            int keyId = signedPreKeys.firstKey();
            LOGGER.log(Level.INFO, "Remove signedPreKey " + keyId + ".");
            removeOmemoSignedPreKey(userDevice, i);
            signedPreKeys = loadOmemoSignedPreKeys(userDevice);
        }
    }
572612
public synchronized void removeLeastUsedElements()
    {    
        int rows = this.removePercent / 100 *  this.length;
        rows     = rows == 0 ? 1 : rows;
        
        while(rows > 0 && this.length > 0) {
            // remove the last element
            Entry<E, T> entry = this.tail.prev;
            
            this.tail.prev = entry.prev;
            entry.prev.next = this.tail;
            map.remove(entry.key);
            this.length--;
            rows--;
        }
    }
41348
static void removeOurDevice(OmemoDevice userDevice, Collection<OmemoDevice> devices) {
        if (devices.contains(userDevice)) {
            devices.remove(userDevice);
        }
    }
288773
public void reset(final long paramNodeKey) {
        mStartKey = paramNodeKey;
        mKey = paramNodeKey;
        mNext = false;
        lastPointer.remove(mRTX);
    }
1111642
public void removeLocks(CmsUUID userId) {

        Iterator<CmsLock> itLocks = OpenCms.getMemoryMonitor().getAllCachedLocks().iterator();
        while (itLocks.hasNext()) {
            CmsLock currentLock = itLocks.next();
            boolean editLock = currentLock.getEditionLock().getUserId().equals(userId);
            boolean sysLock = currentLock.getSystemLock().getUserId().equals(userId);
            if (editLock) {
                unlockResource(currentLock.getResourceName(), false);
            }
            if (sysLock) {
                unlockResource(currentLock.getResourceName(), true);
            }
        }
    }
655099
public void removeEntry(AclEntry entry) {
    switch (entry.getType()) {
      case NAMED_USER:  // fall through
      case NAMED_GROUP: // fall through
      case MASK:
        if (mExtendedEntries != null) {
          mExtendedEntries.removeEntry(entry);
        }
        return;
      case OWNING_USER:  // fall through
      case OWNING_GROUP: // fall through
      case OTHER:
        throw new IllegalStateException(
            "Deleting base entry is not allowed. entry: " + entry);
      default:
        throw new IllegalStateException("Unknown ACL entry type: " + entry.getType());
    }
  }
1153942
def setUnacknowledgedPreKeyMessage(self, preKeyId, signedPreKeyId, baseKey):
        
        self.sessionStructure.pendingPreKey.signedPreKeyId = signedPreKeyId
        self.sessionStructure.pendingPreKey.baseKey = baseKey.serialize()

        if preKeyId is not None:
            self.sessionStructure.pendingPreKey.preKeyId = preKeyId
1105717
public void removeXmitQueuePoint(SIBUuid8 meUuid)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "removeXmitQueuePoint", meUuid);

    if (_xmitQueuePoints != null)
    {
      synchronized(_xmitQueuePoints)
      {
        _xmitQueuePoints.remove(meUuid);
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "removeXmitQueuePoint");
  }
36905
public void remove(int key) {
        int i = binarySearch(mKeys, 0, mSize, key);
        if (i >= 0 && mValues[i] != DELETED) {
            mValues[i] = DELETED;
            mGarbage = true;
        }
    }
978822
public void removeProvider(UserTransactionProvider provider)
   {
      UserTransactionProviderImpl impl = providers.get(provider);

      if (impl != null)
      {
         delegator.removeProvider(impl);
         providers.remove(provider);
      }
   }
209514
void deleteUserIndexForHalfEdges(int userIndex) {
		assert (m_edgeIndices.get(userIndex) != null);
		m_edgeIndices.set(userIndex, null);
	}
707369
public void free()
    {
        m_record.removeKeyArea(this);
        m_record = null;

        m_vKeyFieldList.removeAllElements();
        m_vKeyFieldList = null;
        m_strKeyName = null;            // Key Name
    }
418030
protected void saveRememberMeKeyToCookie(USER_ENTITY userEntity, USER_BEAN userBean) {
        final int expireDays = getRememberMeAccessTokenExpireDays();
        getCookieRememberMeKey().ifPresent(cookieKey -> {
            doSaveRememberMeCookie(userEntity, userBean, expireDays, cookieKey);
        });
    }
1337766
public void removeDevice(String id) throws UnknownDeviceException, NullIdException {
		if ((id == null) || (id.trim().equals(""))) {
			throw new NullIdException();
		}
		if (this.devices.containsKey(id)) {
			this.devices.remove(id);
		} else {
			throw new UnknownDeviceException();
		}
	}
846371
public void remove(String key) {
        String processedKey = processKey(key);
        String orderKey = null;

        // removing key set for all positions
        for (int i = 0; i < this.order.size(); i++) {
            orderKey = this.order.get(i);

            if (orderKey != null && orderKey.equals(processedKey) == true) {
                this.order.remove(i);
            }
        }

        this.types.remove(processedKey);
        this.direction.remove(processedKey);
        this.values.remove(processedKey);
    }
882597
public void replenishKeys(OmemoDevice userDevice)
            throws CorruptedOmemoKeyException {

        T_IdKeyPair identityKeyPair = loadOmemoIdentityKeyPair(userDevice);
        if (identityKeyPair == null) {
            identityKeyPair = generateOmemoIdentityKeyPair();
            storeOmemoIdentityKeyPair(userDevice, identityKeyPair);
        }

        TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
        if (signedPreKeys.size() == 0) {
            changeSignedPreKey(userDevice);
        }

        TreeMap<Integer, T_PreKey> preKeys = loadOmemoPreKeys(userDevice);
        int newKeysCount = PRE_KEY_COUNT_PER_BUNDLE - preKeys.size();
        int startId = preKeys.size() == 0 ? 0 : preKeys.lastKey();

        if (newKeysCount > 0) {
            TreeMap<Integer, T_PreKey> newKeys = generateOmemoPreKeys(startId + 1, newKeysCount);
            storeOmemoPreKeys(userDevice, newKeys);
        }
    }
519901
private static <UK> UK deserializeUserKey(
		DataInputDeserializer dataInputView,
		int userKeyOffset,
		byte[] rawKeyBytes,
		TypeSerializer<UK> keySerializer) throws IOException {
		dataInputView.setBuffer(rawKeyBytes, userKeyOffset, rawKeyBytes.length - userKeyOffset);
		return keySerializer.deserialize(dataInputView);
	}