class CountingPeerPruningFunction implements PeerPruning {

  @Override
  public boolean prunePeer(Peer peer) {
    Integer currentValue = countingOccurrences.putIfAbsent(peer, 1);
    if (currentValue != null) {
      if (currentValue + 1 >= numberOfOccurrences) {
        countingOccurrences.remove(peer);
        return true;
      }
      countingOccurrences.put(peer, currentValue + 1);
    }

    return false;
  }

  public  CountingPeerPruningFunction(int numberOfOccurrences);

}