package com.s24.redjob.channel.command;

import static java.util.Collections.emptyList;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.s24.redjob.queue.QueueWorker;

/**
 * Command to shutdown queue workers.
 */
@JsonTypeName
public class PauseQueueWorker {
   /**
    * Pause (true) or unpause (false) workers?.
    */
   private boolean pause;

   /**
    * Workers of which queues should be paused.
    * If empty, all workers will be paused.
    */
   private Set<String> queues = new HashSet<>();

   /**
    * Hidden default constructor for Jackson.
    */
   @JsonCreator
   PauseQueueWorker() {
   }

   /**
    * Constructor to pause/unpause all workers.
    */
   public PauseQueueWorker(boolean pause) {
      this(pause, emptyList());
   }

   /**
    * Constructor to pause/unpause workers processing the given queues.
    *
    * @param pause
    *           Pause (true) or unpause (false)?
    * @param queues
    *           Queues to select workers. If empty, select all workers.
    */
   public PauseQueueWorker(boolean pause, String... queues) {
      this(pause, Arrays.asList(queues));
   }

   /**
    * Constructor to pause/unpause workers processing the given queues.
    *
    * @param pause
    *           Pause (true) or unpause (false)?
    * @param queues
    *           Queues to select workers. If empty, select all workers.
    */
   public PauseQueueWorker(boolean pause, Collection<String> queues) {
      this.pause = pause;
      this.queues.addAll(queues);
   }

   /**
    * Pause (true) or unpause (false) workers?.
    */
   public boolean isPause() {
      return pause;
   }

   /**
    * Workers of which queues should be paused.
    * If empty, all workers will be paused.
    */
   public Set<String> getQueues() {
      return queues;
   }

   /**
    * Does the worker match the selectors of the job?.
    */
   protected boolean matches(QueueWorker worker) {
      return queues.isEmpty() || worker.getQueues().stream().filter(queues::contains).findAny().isPresent();
   }
}

@@ -45,298 +45,298 @@
 ort 
-static java.util.Collections.emptyList;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Aimport com.fasterxml.jackson.annotation.JsonCreator;%0Aimport com.fasterxml.jackson.annotation.JsonTypeName;%0Aimport com.s24.redjob.queue.QueueWorker
+com.fasterxml.jackson.annotation.JsonCreator;%0Aimport com.fasterxml.jackson.annotation.JsonTypeName;%0Aimport com.s24.redjob.queue.QueueWorker;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Aimport static java.util.Collections.emptyList
 ;%0A%0A/
@@ -2144,14 +2144,16 @@
 m().
-filter
+anyMatch
 (que
@@ -2170,30 +2170,8 @@
 ins)
-.findAny().isPresent()
 ;%0A  

Use more Java 8