Deluge Docker Compose

---
version: "2.1"
services:
  deluge:
    image: ghcr.io/linuxserver/deluge
    container_name: deluge
    environment:
      - PUID=1001
      - PGID=1001
      - TZ=$TZ
      - DELUGE_LOGLEVEL=error #optional
    volumes:
      - $HOME/source/deluge:/config
      - /mnt:/downloads
    ports:
      - 8112:8112
      - 6881:6881
      - 6881:6881/udp
    restart: unless-stopped

FindTheClosest

public class FindTheClosest {

    private final Number target;
    private final Number[] numbers;

    public FindTheClosest(Number target, Number[] numbers) {
        this.target = target;
        this.numbers = numbers;
    }

    public Number execute() {
        Stream<Number> stream = Arrays.stream(numbers);
        Optional<Number> optional = stream.min(Comparator.comparing(number -> {
            double delta = target.doubleValue() - number.doubleValue();
            return delta == 0 ? Integer.MAX_VALUE : Math.abs(delta + 1F / Integer.MAX_VALUE);
        }));
        return optional.orElse(target);
    }
}