  /**
   * Returns a {@code TopKSelector} that collects the greatest {@code k} elements added to it,
   * relative to the specified comparator, and returns them via {@code #topK} in descending order.
   *
   * @throws IllegalArgumentException if {@code k < 0} or {@code k > Integer.MAX_VALUE / 2}
   */
  public static <T extends @Nullable Object> TopKSelector<T> greatest(
      int k, Comparator<? super T> comparator) {
    return new TopKSelector<>(Ordering.from(comparator).reverse(), k);
  }

  /**
   * Returns a {@code TopKSelector} that collects the greatest {@code k} elements added to it,
   * relative to the specified comparator, and returns them via {@code #topK} in descending order.
   *
   * @throws IllegalArgumentException if {@code k < 0} or {@code k > Integer.MAX_VALUE / 2}
   */
  public static <T extends @Nullable Object> TopKSelector<T> greatest(
      int k, Comparator<? super T> comparator) {
    return new TopKSelector<T>(Ordering.from(comparator).reverse(), k);
  }

Replace Generic With Diamond TopKSelector<T> with TopKSelector<> in method public greatest(k int, comparator Comparator<? super T>) : TopKSelector<T> from class dev.mccue.guava.collect.TopKSelector


    private AvlNode<E> addRightChild(@ParametricNullness E e, int count) {
      right = new AvlNode<>(e, count);
      successor(this, right, succ());
      height = Math.max(2, height);
      distinctElements++;
      totalCount += count;
      return this;
    }

    private AvlNode<E> addRightChild(@ParametricNullness E e, int count) {
      right = new AvlNode<E>(e, count);
      successor(this, right, succ());
      height = Math.max(2, height);
      distinctElements++;
      totalCount += count;
      return this;
    }

Replace Generic With Diamond AvlNode<E> with AvlNode<> in method private addRightChild(e E, count int) : AvlNode<E> from class dev.mccue.guava.collect.TreeMultiset.AvlNode


    private AvlNode<E> addLeftChild(@ParametricNullness E e, int count) {
      left = new AvlNode<>(e, count);
      successor(pred(), left, this);
      height = Math.max(2, height);
      distinctElements++;
      totalCount += count;
      return this;
    }

    private AvlNode<E> addLeftChild(@ParametricNullness E e, int count) {
      left = new AvlNode<E>(e, count);
      successor(pred(), left, this);
      height = Math.max(2, height);
      distinctElements++;
      totalCount += count;
      return this;
    }

Replace Generic With Diamond AvlNode<E> with AvlNode<> in method private addLeftChild(e E, count int) : AvlNode<E> from class dev.mccue.guava.collect.TreeMultiset.AvlNode


/**
   * Creates a new, empty multiset, sorted according to the elements' natural order. All elements
   * inserted into the multiset must implement the {@code Comparable} interface. Furthermore, all
   * such elements must be mutually comparable: {@code e1.compareTo(e2)} must not throw a
   * {@code ClassCastException} for any elements {@code e1} and {@code e2} in the multiset. If the
   * user attempts to add an element to the multiset that violates this constraint (for example, the
   * user attempts to add a string element to a set whose elements are integers), the {@code
   * add(Object)} call will throw a {@code ClassCastException}.
   *
   *
The type specification is {@code <E extends Comparable>}, instead of the more specific
   * {@code <E extends Comparable<? super E>>}, to support classes defined without generics.
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  public static <E extends Comparable> TreeMultiset<E> create() {
    return new TreeMultiset<>(Ordering.natural());
  }

/**
   * Creates a new, empty multiset, sorted according to the elements' natural order. All elements
   * inserted into the multiset must implement the {@code Comparable} interface. Furthermore, all
   * such elements must be mutually comparable: {@code e1.compareTo(e2)} must not throw a
   * {@code ClassCastException} for any elements {@code e1} and {@code e2} in the multiset. If the
   * user attempts to add an element to the multiset that violates this constraint (for example, the
   * user attempts to add a string element to a set whose elements are integers), the {@code
   * add(Object)} call will throw a {@code ClassCastException}.
   *
   *
The type specification is {@code <E extends Comparable>}, instead of the more specific
   * {@code <E extends Comparable<? super E>>}, to support classes defined without generics.
   */
  @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989
  public static <E extends Comparable> TreeMultiset<E> create() {
    return new TreeMultiset<E>(Ordering.natural());
  }

Replace Generic With Diamond TreeMultiset<E> with TreeMultiset<> in method public create() : TreeMultiset<E> from class dev.mccue.guava.collect.TreeMultiset


  @CanIgnoreReturnValue
  @Override
  public int add(@ParametricNullness E element, int occurrences) {
    checkNonnegative(occurrences, "occurrences");
    if (occurrences == 0) {
      return count(element);
    }
    checkArgument(range.contains(element));
    AvlNode<E> root = rootReference.get();
    if (root == null) {
      int unused = comparator().compare(element, element);
      AvlNode<E> newRoot = new AvlNode<>(element, occurrences);
      successor(header, newRoot, header);
      rootReference.checkAndSet(root, newRoot);
      return 0;
    }
    int[] result = new int[1]; // used as a mutable int reference to hold result
    AvlNode<E> newRoot = root.add(comparator(), element, occurrences, result);
    rootReference.checkAndSet(root, newRoot);
    return result[0];
  }

  @CanIgnoreReturnValue
  @Override
  public int add(@ParametricNullness E element, int occurrences) {
    checkNonnegative(occurrences, "occurrences");
    if (occurrences == 0) {
      return count(element);
    }
    checkArgument(range.contains(element));
    AvlNode<E> root = rootReference.get();
    if (root == null) {
      int unused = comparator().compare(element, element);
      AvlNode<E> newRoot = new AvlNode<E>(element, occurrences);
      successor(header, newRoot, header);
      rootReference.checkAndSet(root, newRoot);
      return 0;
    }
    int[] result = new int[1]; // used as a mutable int reference to hold result
    AvlNode<E> newRoot = root.add(comparator(), element, occurrences, result);
    rootReference.checkAndSet(root, newRoot);
    return result[0];
  }

Replace Generic With Diamond AvlNode<E> with AvlNode<> in method public add(element E, occurrences int) : int from class dev.mccue.guava.collect.TreeMultiset


  @Override
  public SortedMultiset<E> headMultiset(@ParametricNullness E upperBound, BoundType boundType) {
    return new TreeMultiset<>(
        rootReference,
        range.intersect(GeneralRange.upTo(comparator(), upperBound, boundType)),
        header);
  }

  @Override
  public SortedMultiset<E> headMultiset(@ParametricNullness E upperBound, BoundType boundType) {
    return new TreeMultiset<E>(
        rootReference,
        range.intersect(GeneralRange.upTo(comparator(), upperBound, boundType)),
        header);
  }

Replace Generic With Diamond TreeMultiset<E> with TreeMultiset<> in method public headMultiset(upperBound E, boundType BoundType) : SortedMultiset<E> from class dev.mccue.guava.collect.TreeMultiset


  @Override
  public SortedMultiset<E> tailMultiset(@ParametricNullness E lowerBound, BoundType boundType) {
    return new TreeMultiset<>(
        rootReference,
        range.intersect(GeneralRange.downTo(comparator(), lowerBound, boundType)),
        header);
  }

  @Override
  public SortedMultiset<E> tailMultiset(@ParametricNullness E lowerBound, BoundType boundType) {
    return new TreeMultiset<E>(
        rootReference,
        range.intersect(GeneralRange.downTo(comparator(), lowerBound, boundType)),
        header);
  }

Replace Generic With Diamond TreeMultiset<E> with TreeMultiset<> in method public tailMultiset(lowerBound E, boundType BoundType) : SortedMultiset<E> from class dev.mccue.guava.collect.TreeMultiset


    private PostOrderNode<T> expand(T t) {
      return new PostOrderNode<>(t, children(t).iterator());
    }

    private PostOrderNode<T> expand(T t) {
      return new PostOrderNode<T>(t, children(t).iterator());
    }

Replace Generic With Diamond PostOrderNode<T> with PostOrderNode<> in method private expand(t T) : PostOrderNode<T> from class dev.mccue.guava.collect.TreeTraverser.PostOrderIterator


    BreadthFirstIterator(T root) {
      this.queue = new ArrayDeque<>();
      queue.add(root);
    }

    BreadthFirstIterator(T root) {
      this.queue = new ArrayDeque<T>();
      queue.add(root);
    }

Replace Generic With Diamond ArrayDeque<T> with ArrayDeque<> in method package BreadthFirstIterator(root T) from class dev.mccue.guava.collect.TreeTraverser.BreadthFirstIterator


  /**
   * Returns an iterator containing only {@code value}.
   *
   * <p>The {@code Iterable} equivalent of this method is {@code Collections#singleton}.
   */
  public static <T extends @Nullable Object> UnmodifiableIterator<T> singletonIterator(
      @ParametricNullness T value) {
    return new SingletonIterator<>(value);
  }

  /**
   * Returns an iterator containing only {@code value}.
   *
   * <p>The {@code Iterable} equivalent of this method is {@code Collections#singleton}.
   */
  public static <T extends @Nullable Object> UnmodifiableIterator<T> singletonIterator(
      @ParametricNullness T value) {
    return new UnmodifiableIterator<T>() {
      boolean done;

      @Override
      public boolean hasNext() {
        return !done;
      }

      @Override
      @ParametricNullness
      public T next() {
        if (done) {
          throw new NoSuchElementException();
        }
        done = true;
        return value;
      }
    };
  }

Replace Generic With Diamond UnmodifiableIterator<T> with SingletonIterator<> in method public singletonIterator(value T) : UnmodifiableIterator<T> from class dev.mccue.guava.collect.Iterators


    @Before
    public void setUp() {
        gameState = GameState.getInstance(true);
        gameState.setPlayers(new ArrayList<>(Arrays.asList(new Player("1"), new Player("2"))));
        gameState.setNumPlayer(2);
        gameState.setCurrPlayer(gameState.getPlayers().get(0));
        gameState.getBoard()[2][3].setWorker(gameState.getPlayers().get(1).getWorkers().get(0));
        gameState.getBoard()[3][3].setWorker(gameState.getCurrPlayer().getWorkers().get(1));
        gameState.getBoard()[1][1].setWorker(gameState.getPlayers().get(1).getWorkers().get(1));
        gameState.getBoard()[3][1].setDome(true);
    }

    @Before
    public void setUp() {
        gameState = GameState.getInstance(true);
        gameState.setPlayers(new ArrayList<Player>(Arrays.asList(new Player("1"), new Player("2"))));
        gameState.setNumPlayer(2);
        gameState.setCurrPlayer(gameState.getPlayers().get(0));
        gameState.getBoard()[2][3].setWorker(gameState.getPlayers().get(1).getWorkers().get(0));
        gameState.getBoard()[3][3].setWorker(gameState.getCurrPlayer().getWorkers().get(1));
        gameState.getBoard()[1][1].setWorker(gameState.getPlayers().get(1).getWorkers().get(1));
        gameState.getBoard()[3][1].setDome(true);
    }

Replace Generic With Diamond ArrayList<Player> with ArrayList<> in method public setUp() : void from class it.polimi.ingsw.PSP4.model.PositionTest


    public void asyncSend(Object message) {
        new Thread(() -> send(message)).start();
    }

    public void asyncSend(Object message) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                send(message);
            }
        }).start();
    }

Replace Anonymous With Lambda it.polimi.ingsw.PSP4.server.SocketClientConnection.asyncSend.start.new Thread.new Runnable with () -> send(message) in method public asyncSend(message Object) : void from class it.polimi.ingsw.PSP4.server.SocketClientConnection


    private String readContents(URL resource) throws IOException {
        StringBuilder sb = new StringBuilder();

        try (InputStream in = resource.openStream(); BufferedInputStream reader = new BufferedInputStream(in)) {

            int b = reader.read();
            while (b != -1) {
                sb.append((char) b);
                b = reader.read();
            }

            return sb.toString().trim();
        }
    }

    private String readContents(URL resource) throws IOException {
        InputStream in = resource.openStream();
        BufferedInputStream reader = null;
        StringBuffer sb = new StringBuffer();

        try {
            reader = new BufferedInputStream(in);

            int b = reader.read();
            while (b != -1) {
                sb.append((char) b);
                b = reader.read();
            }

            return sb.toString().trim();
        } finally {
            try {
                in.close();
                reader.close();
            } catch (Exception e) {
            }
        }
    }

Try With Resources try(InputStream in=resource.openStream(); BufferedInputStream reader=new BufferedInputStream(in)) in method private readContents(resource URL) : String from class io.github.vipcxj.beanknife.core.utils.ResourceFinder


    /**
     * @return Returns a {@code HashSet} containing the player's next possible actions, i.e. {@link Action#MOVE}, {@link Action#BUILD}, {@link Action#BUILDDOME} and {@link Action#END}
     */
    public ArrayList<Action> getPossibleActions() { return new ArrayList<>(possibleActions); }

    /**
     * @return Returns a {@code HashSet} containing the player's next possible actions, i.e. {@link Action#MOVE}, {@link Action#BUILD}, {@link Action#BUILDDOME} and {@link Action#END}
     */
    public HashSet<Action> getPossibleActions() { return new HashSet<Action>(possibleActions); }

Replace Generic With Diamond HashSet<Action> with ArrayList<> in method public getPossibleActions() : ArrayList<Action> from class it.polimi.ingsw.model.Player


    @BeforeEach
    void setUp() {
        List<String> users = new ArrayList<String>();
        users.add("simone");
        users.add("marco");
        match = new Match(users);
        game = new Game(match);
        div1 = new SetEffectOnOpponent(new StandardDivinity());
        div1.setupDivinity(new ArrayList<>());
        match.getPlayers().get(0).setDivinity(div1);
        div2 = new StandardDivinity();
        match.getPlayers().get(1).setDivinity(div2);
    }

    @BeforeEach
    void setUp() {
        List<String> users = new ArrayList<String>();
        users.add("simone");
        users.add("marco");
        match = new Match(users);
        game = new Game(match);
        div1 = new SetEffectOnOpponent(new StandardDivinity());
        div1.setupDivinity(new HashSet<Action>());
        match.getPlayers().get(0).setDivinity(div1);
        div2 = new StandardDivinity();
        match.getPlayers().get(1).setDivinity(div2);
    }

Replace Generic With Diamond HashSet<Action> with ArrayList<> in method package setUp() : void from class it.polimi.ingsw.model.cards.SetEffectOnOpponentTest


    private void doLogin() {
        final CountDownLatch countDownLatch = new CountDownLatch(1);

        userClient.login(new StreamObserver<>() {

            @Override
            public void onNext(Login login) {
                LOG.info("User {} successfully logged in.", login.getAccount().getUsername());
            }

            @Override
            public void onCompleted() {
                countDownLatch.countDown();
            }

            @Override
            public <E extends MatchbookSDKException> void onError(E exception) {
                throw new MatchbookSDKHttpException(exception, ErrorType.UNAUTHENTICATED);
            }
        });

        try {
            countDownLatch.await(loginTimeout, TimeUnit.MILLISECONDS);
        } catch (InterruptedException exception) {
            throw new MatchbookSDKHttpException(exception, ErrorType.UNAUTHENTICATED);
        }
    }

    private void doLogin() {
        final CountDownLatch countDownLatch = new CountDownLatch(1);

        userClient.login(new StreamObserver<Login>() {

            @Override
            public void onNext(Login login) {
                LOG.info("User {} successfully logged in.", login.getAccount().getUsername());
            }

            @Override
            public void onCompleted() {
                countDownLatch.countDown();
            }

            @Override
            public <E extends MatchbookSDKException> void onError(E exception) {
                throw new MatchbookSDKHttpException(exception, ErrorType.UNAUTHENTICATED);
            }
        });

        try {
            countDownLatch.await(loginTimeout, TimeUnit.MILLISECONDS);
        } catch (InterruptedException exception) {
            throw new MatchbookSDKHttpException(exception, ErrorType.UNAUTHENTICATED);
        }
    }

Replace Generic With Diamond StreamObserver<Login> with StreamObserver<> in method private doLogin() : void from class com.matchbook.sdk.rest.workers.SessionKeepAliveScheduler


        @Override
        public void onResponse(InputStream inputStream) {
            try (Parser parser = serializer.newParser(inputStream)) {
                reader.startReading(parser);
                while (reader.hasMoreItems()) {
                    T item = reader.readNextItem();
                    observer.onNext(item);
                }
                observer.onCompleted();
            } catch (IOException e) {
                MatchbookSDKHttpException exception = new MatchbookSDKHttpException(e.getMessage(), e);
                observer.onError(exception);
            }
        }

        @Override
        public void onResponse(InputStream inputStream) {
            try {
                RestResponse<T> restResponse = serializer.readObject(inputStream, responseClass);
                restResponse.getContent().forEach(observer::onNext);
                observer.onCompleted();
            } catch (IOException e) {
                MatchbookSDKHttpException exception = new MatchbookSDKHttpException(e.getMessage(), e);
                observer.onError(exception);
            }
        }

Try With Resources try(Parser parser=serializer.newParser(inputStream)) in method public onResponse(inputStream InputStream) : void from class com.matchbook.sdk.rest.AbstractRestClient.RestCallback


        @Override
        public void onResponse(InputStream inputStream) {
            try {
                Parser parser = serializer.newParser(inputStream);
                reader.startReading(parser);
                while (reader.hasMoreItems()) {
                    observer.onNext(reader.readNextItem());
                }
                observer.onCompleted();
            } catch (IOException e) {
                MatchbookSDKHttpException exception = new MatchbookSDKHttpException(e.getMessage(), e);
                observer.onError(exception);
            }
        }

Try With Resources try(Parser parser=serializer.newParser(inputStream)) in method public onResponse(inputStream InputStream) : void from class com.matchbook.sdk.rest.AbstractRestClient.RestCallback2


            @Override
            public List<Cookie> loadForRequest(HttpUrl url) {
                List<Cookie> cookies = cookieStore.get(url.host());

                if (cookies == null) {
                    return new ArrayList<>();
                }

                final long now = System.currentTimeMillis();

                // filter out expired cookies
                List<Cookie> unexpiredCookies = cookies.stream()
                    .filter(cookie -> cookie.expiresAt() > now)
                    .collect(Collectors.toList());

                if (cookies.size() > unexpiredCookies.size()){
                    cookieStore.put(url.host(), unexpiredCookies);
                }

                return unexpiredCookies;
            }

            @Override
            public List<Cookie> loadForRequest(HttpUrl url) {
                List<Cookie> cookies = cookieStore.get(url.host());

                if (cookies == null) {
                    return new ArrayList<Cookie>();
                }

                final long now = System.currentTimeMillis();

                // filter out expired cookies
                List<Cookie> unexpiredCookies = cookies.stream()
                    .filter(cookie -> cookie.expiresAt() > now)
                    .collect(Collectors.toList());

                if (cookies.size() > unexpiredCookies.size()){
                    cookieStore.put(url.host(), unexpiredCookies);
                }

                return unexpiredCookies;
            }

Replace Generic With Diamond ArrayList<Cookie> with ArrayList<> in method public loadForRequest(url HttpUrl) : List<Cookie> from class com.matchbook.sdk.rest.configs.wrappers.HttpClientWrapper.createCookieJar.new CookieJar


    /**
     * Create a {@link CookieJar} to hold in memory the cookies. These are stored based on the host of the request.
     *
     * @return a {@link CookieJar} instance
     */
    private CookieJar createCookieJar() {
        return new CookieJar() {
            private final ConcurrentHashMap<String, List<Cookie>> cookieStore = new ConcurrentHashMap<>();

            @Override
            public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
                if (cookies != null) {
                    cookieStore.put(url.host(), cookies);
                }
            }

            @Override
            public List<Cookie> loadForRequest(HttpUrl url) {
                List<Cookie> cookies = cookieStore.get(url.host());

                if (cookies == null) {
                    return new ArrayList<>();
                }

                final long now = System.currentTimeMillis();

                // filter out expired cookies
                List<Cookie> unexpiredCookies = cookies.stream()
                    .filter(cookie -> cookie.expiresAt() > now)
                    .collect(Collectors.toList());

                if (cookies.size() > unexpiredCookies.size()){
                    cookieStore.put(url.host(), unexpiredCookies);
                }

                return unexpiredCookies;
            }
        };
    }

    /**
     * Create a {@link CookieJar} to hold in memory the cookies. These are stored based on the host of the request.
     *
     * @return a {@link CookieJar} instance
     */
    private CookieJar createCookieJar() {
        return new CookieJar() {
            private final ConcurrentHashMap<String, List<Cookie>> cookieStore = new ConcurrentHashMap<>();

            @Override
            public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
                if (cookies != null) {
                    cookieStore.put(url.host(), cookies);
                }
            }

            @Override
            public List<Cookie> loadForRequest(HttpUrl url) {
                List<Cookie> cookies = cookieStore.get(url.host());

                if (cookies == null) {
                    return new ArrayList<Cookie>();
                }

                final long now = System.currentTimeMillis();

                // filter out expired cookies
                List<Cookie> unexpiredCookies = cookies.stream()
                    .filter(cookie -> cookie.expiresAt() > now)
                    .collect(Collectors.toList());

                if (cookies.size() > unexpiredCookies.size()){
                    cookieStore.put(url.host(), unexpiredCookies);
                }

                return unexpiredCookies;
            }
        };
    }

Replace Generic With Diamond ArrayList<Cookie> with ArrayList<> in method private createCookieJar() : CookieJar from class com.matchbook.sdk.rest.configs.wrappers.HttpClientWrapper


  /**
   * Returns the transitive closure of {@code graph}. The transitive closure of a graph is another
   * graph with an edge connecting node A to node B if node B is {@code #reachableNodes(Graph,
   * Object) reachable} from node A.
   *
   * <p>This is a "snapshot" based on the current topology of {@code graph}, rather than a live view
   * of the transitive closure of {@code graph}. In other words, the returned {@code Graph} will not
   * be updated after modifications to {@code graph}.
   *
   * @since 33.1.0 (present with return type {@code Graph} since 20.0)
   */
  // TODO(b/31438252): Consider potential optimizations for this algorithm.
  public static <N> ImmutableGraph<N> transitiveClosure(Graph<N> graph) {
    ImmutableGraph.Builder<N> transitiveClosure =
        GraphBuilder.from(graph).allowsSelfLoops(true).<N>immutable();
    // Every node is, at a minimum, reachable from itself. Since the resulting transitive closure
    // will have no isolated nodes, we can skip adding nodes explicitly and let putEdge() do it.

    if (graph.isDirected()) {
      // Note: works for both directed and undirected graphs, but we only use in the directed case.
      for (N node : graph.nodes()) {
        for (N reachableNode : reachableNodes(graph, node)) {
          transitiveClosure.putEdge(node, reachableNode);
        }
      }
    } else {
      // An optimization for the undirected case: for every node B reachable from node A,
      // node A and node B have the same reachability set.
      Set<N> visitedNodes = new HashSet<>();
      for (N node : graph.nodes()) {
        if (!visitedNodes.contains(node)) {
          Set<N> reachableNodes = reachableNodes(graph, node);
          visitedNodes.addAll(reachableNodes);
          int pairwiseMatch = 1; // start at 1 to include self-loops
          for (N nodeU : reachableNodes) {
            for (N nodeV : Iterables.limit(reachableNodes, pairwiseMatch++)) {
              transitiveClosure.putEdge(nodeU, nodeV);
            }
          }
        }
      }
    }

    return transitiveClosure.build();
  }

  /**
   * Returns the transitive closure of {@code graph}. The transitive closure of a graph is another
   * graph with an edge connecting node A to node B if node B is {@code #reachableNodes(Graph,
   * Object) reachable} from node A.
   *
   * <p>This is a "snapshot" based on the current topology of {@code graph}, rather than a live view
   * of the transitive closure of {@code graph}. In other words, the returned {@code Graph} will not
   * be updated after modifications to {@code graph}.
   *
   * @since 33.1.0 (present with return type {@code Graph} since 20.0)
   */
  // TODO(b/31438252): Consider potential optimizations for this algorithm.
  public static <N> ImmutableGraph<N> transitiveClosure(Graph<N> graph) {
    ImmutableGraph.Builder<N> transitiveClosure =
        GraphBuilder.from(graph).allowsSelfLoops(true).<N>immutable();
    // Every node is, at a minimum, reachable from itself. Since the resulting transitive closure
    // will have no isolated nodes, we can skip adding nodes explicitly and let putEdge() do it.

    if (graph.isDirected()) {
      // Note: works for both directed and undirected graphs, but we only use in the directed case.
      for (N node : graph.nodes()) {
        for (N reachableNode : reachableNodes(graph, node)) {
          transitiveClosure.putEdge(node, reachableNode);
        }
      }
    } else {
      // An optimization for the undirected case: for every node B reachable from node A,
      // node A and node B have the same reachability set.
      Set<N> visitedNodes = new HashSet<N>();
      for (N node : graph.nodes()) {
        if (!visitedNodes.contains(node)) {
          Set<N> reachableNodes = reachableNodes(graph, node);
          visitedNodes.addAll(reachableNodes);
          int pairwiseMatch = 1; // start at 1 to include self-loops
          for (N nodeU : reachableNodes) {
            for (N nodeV : Iterables.limit(reachableNodes, pairwiseMatch++)) {
              transitiveClosure.putEdge(nodeU, nodeV);
            }
          }
        }
      }
    }

    return transitiveClosure.build();
  }

Replace Generic With Diamond HashSet<N> with HashSet<> in method public transitiveClosure(graph Graph<N>) : ImmutableGraph<N> from class dev.mccue.guava.graph.Graphs


  /**
   * Returns a view of {@code graph} with the direction (if any) of every edge reversed. All other
   * properties remain intact, and further updates to {@code graph} will be reflected in the view.
   */
  public static <N> Graph<N> transpose(Graph<N> graph) {
    if (!graph.isDirected()) {
      return graph; // the transpose of an undirected graph is an identical graph
    }

    if (graph instanceof TransposedGraph) {
      return ((TransposedGraph<N>) graph).graph;
    }

    return new TransposedGraph<>(graph);
  }

  /**
   * Returns a view of {@code graph} with the direction (if any) of every edge reversed. All other
   * properties remain intact, and further updates to {@code graph} will be reflected in the view.
   */
  public static <N> Graph<N> transpose(Graph<N> graph) {
    if (!graph.isDirected()) {
      return graph; // the transpose of an undirected graph is an identical graph
    }

    if (graph instanceof TransposedGraph) {
      return ((TransposedGraph<N>) graph).graph;
    }

    return new TransposedGraph<N>(graph);
  }

Replace Generic With Diamond TransposedGraph<N> with TransposedGraph<> in method public transpose(graph Graph<N>) : Graph<N> from class dev.mccue.guava.graph.Graphs


    public static <T> void createNewTable(Class<?> clz, T entity) {
        try(Connection con = ConnectionToDB.openConnectionToDB()) {
            statement = con.createStatement();
            String query = getStringQuery(clz, entity);
            statement.executeUpdate(query);
        } catch (SQLException e) {
            logger.error("cant execute Update the statement SQL Exception");
            e.printStackTrace();
        }
    }

    public void createNewTable(T entity) throws ClassNotFoundException {
        try {
            openConnectionToDB();
            String query= getStringQuery(entity);
            statement.executeUpdate(query);
        } catch (SQLException e) {
            logger.error("SQL Exception");
            e.printStackTrace();
        }
        closeConnectionToDB();
    }

Try With Resources try(Connection con=ConnectionToDB.openConnectionToDB()) in method public createNewTable(clz Class<?>, entity T) : void from class repository.queries.CreateTable


    public static void deleteEntireTable(String tableName)  {
        try(Connection con = ConnectionToDB.openConnectionToDB()) {
            statement = con.createStatement();
            String query = "drop table " + tableName;
            statement.executeUpdate(query);
            logger.info("Table is deleted from the table successfully..................");
        } catch (SQLException e) {
            logger.error("cant execute Update the statement SQL Exception");
            e.printStackTrace();
        }
    }

    public void deleteEntireTable(String tableName)  {
        String str= "drop table "+tableName;
        try {
            statement= (Statement) con.createStatement();
            statement.executeUpdate(str);
            logger.info("Table is deleted from the table successfully..................");
        } catch (SQLException e) {
            logger.error("SQL Exception");
            e.printStackTrace();
        }
    }

Try With Resources try(Connection con=ConnectionToDB.openConnectionToDB()) in method public deleteEntireTable(tableName String) : void from class repository.queries.Delete


/**
     * Default test SPI: {@link TestMonetaryConversionsSingletonSpi} supports one conversion provider name.
     * Dynamic SPI: Mock supporting two conversion provider names.
     * Testing following steps:
     *

     *
use default SPI

     *
number of conversion provider names should be one

     *
use dynamic SPI

     *
number of conversion provider names should be two

     *
use default SPI

     *
number of conversion provider names should be one

     *

     */
    @Test
    public void testMonetaryConversionsSingletonSpi() {
        assertEquals(MonetaryConversions.getConversionProviderNames().size(),1);
        MonetaryConversionsSingletonSpi mock = mock(MonetaryConversionsSingletonSpi.class);
        doReturn(new HashSet<>(Arrays.asList("conversionProviderOne", "conversionProviderTwo"))).when(mock).getProviderNames();
        registerService(MonetaryConversionsSingletonSpi.class, mock);
        initTestServiceProvider();
        assertEquals(MonetaryConversions.getConversionProviderNames().size(),2);
        initOriginalServiceProvider();
        assertEquals(MonetaryConversions.getConversionProviderNames().size(),1);

    }

/**
     * Default test SPI: {@link TestMonetaryConversionsSingletonSpi} supports one conversion provider name.
     * Dynamic SPI: Mock supporting two conversion provider names.
     * Testing following steps:
     *

     *
use default SPI

     *
number of conversion provider names should be one

     *
use dynamic SPI

     *
number of conversion provider names should be two

     *
use default SPI

     *
number of conversion provider names should be one

     *

     */
    @Test
    public void testMonetaryConversionsSingletonSpi() {
        assertEquals(MonetaryConversions.getConversionProviderNames().size(),1);
        MonetaryConversionsSingletonSpi mock = mock(MonetaryConversionsSingletonSpi.class);
        doReturn(new HashSet<String>(Arrays.asList("conversionProviderOne","conversionProviderTwo"))).when(mock).getProviderNames();
        registerService(MonetaryConversionsSingletonSpi.class, mock);
        initTestServiceProvider();
        assertEquals(MonetaryConversions.getConversionProviderNames().size(),2);
        initOriginalServiceProvider();
        assertEquals(MonetaryConversions.getConversionProviderNames().size(),1);

    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public testMonetaryConversionsSingletonSpi() : void from class javax.money.convert.MonetaryConversionsDynamicServiceProviderTest


/**
     * Default SPI: {@link DefaultMonetaryFormatsSingletonSpi} supports one format provider name.
     * Dynamic SPI: Mock supporting two format provider names.
     * Testing following steps:
     *

     *
use default SPI

     *
number of format provider names should be one

     *
use dynamic SPI

     *
number of format provider names should be two

     *
use default SPI

     *
number of format provider names should be one

     *

     */
    @Test
    public void testMonetaryFormatsSingletonSpi() {
        assertEquals(MonetaryFormats.getFormatProviderNames().size(),1);
        MonetaryFormatsSingletonSpi mock = mock(MonetaryFormatsSingletonSpi.class);
        doReturn(new HashSet<>(Arrays.asList("formatProviderOne", "formatProviderTow"))).when(mock).getProviderNames();
        registerService(MonetaryFormatsSingletonSpi.class, mock);
        initTestServiceProvider();
        assertEquals(MonetaryFormats.getFormatProviderNames().size(),2);
        initOriginalServiceProvider();
        assertEquals(MonetaryFormats.getFormatProviderNames().size(),1);
    }

/**
     * Default SPI: {@link DefaultMonetaryFormatsSingletonSpi} supports one format provider name.
     * Dynamic SPI: Mock supporting two format provider names.
     * Testing following steps:
     *

     *
use default SPI

     *
number of format provider names should be one

     *
use dynamic SPI

     *
number of format provider names should be two

     *
use default SPI

     *
number of format provider names should be one

     *

     */
    @Test
    public void testMonetaryFormatsSingletonSpi() {
        assertEquals(MonetaryFormats.getFormatProviderNames().size(),1);
        MonetaryFormatsSingletonSpi mock = mock(MonetaryFormatsSingletonSpi.class);
        doReturn(new HashSet<String>(Arrays.asList("formatProviderOne","formatProviderTow"))).when(mock).getProviderNames();
        registerService(MonetaryFormatsSingletonSpi.class, mock);
        initTestServiceProvider();
        assertEquals(MonetaryFormats.getFormatProviderNames().size(),2);
        initOriginalServiceProvider();
        assertEquals(MonetaryFormats.getFormatProviderNames().size(),1);
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public testMonetaryFormatsSingletonSpi() : void from class javax.money.format.MonetaryFormatsDynamicServiceProviderTest


    @Override
    public String toString(){
        StringBuilder attrsBuilder = new StringBuilder();
        for(Map.Entry<Class<?>,Map<Object,Object>> en : this.data.entrySet()){
            Map<Object,Object> sortedMap = new TreeMap<>((o1, o2) -> o1.toString().compareTo(o2.toString()));
            sortedMap.putAll(en.getValue());
            for(Map.Entry<Object,Object> entry : sortedMap.entrySet()){
                Object key = entry.getKey();
                attrsBuilder.append("  ");
                if(key.getClass() == Class.class){
                    attrsBuilder.append(((Class) key).getName());
                }else{
                    attrsBuilder.append(key);
                }
                attrsBuilder.append('[');
                if(en.getKey().getName().startsWith("java.lang.")){
                    attrsBuilder.append(en.getKey().getName().substring("java.lang.".length()));
                }else{
                    attrsBuilder.append(en.getKey().getName());
                }
                attrsBuilder.append("]=");
                attrsBuilder.append(entry.getValue()).append('\n');
            }
        }
        return getClass().getSimpleName() + " (\n" + attrsBuilder.toString() + ')';
    }

    @Override
    public String toString(){
        StringBuilder attrsBuilder = new StringBuilder();
        for(Map.Entry<Class<?>,Map<Object,Object>> en : this.data.entrySet()){
            Map<Object,Object> sortedMap = new TreeMap<>(new Comparator<Object>(){
                @Override
                public int compare(Object o1, Object o2){
                    return o1.toString().compareTo(o2.toString());
                }
            });
            sortedMap.putAll(en.getValue());
            for(Map.Entry<Object,Object> entry : sortedMap.entrySet()){
                Object key = entry.getKey();
                attrsBuilder.append("  ");
                if(key.getClass() == Class.class){
                    attrsBuilder.append(((Class) key).getName());
                }else{
                    attrsBuilder.append(key);
                }
                attrsBuilder.append('[');
                if(en.getKey().getName().startsWith("java.lang.")){
                    attrsBuilder.append(en.getKey().getName().substring("java.lang.".length()));
                }else{
                    attrsBuilder.append(en.getKey().getName());
                }
                attrsBuilder.append("]=");
                attrsBuilder.append(entry.getValue()).append('\n');
            }
        }
        return getClass().getSimpleName() + " (\n" + attrsBuilder.toString() + ')';
    }

Replace Anonymous With Lambda javax.money.AbstractContext.toString.sortedMap.new TreeMap<>.new Comparator<Object> with (o1, o2) -> o1.toString().compareTo(o2.toString()) in method public toString() : String from class javax.money.AbstractContext


	@Override
	public MonetaryOperator getRounding(RoundingContext roundingContext){
        if(roundingContext.getRoundingId()!=null){
            return getCustomRounding(roundingContext.getRoundingId());
        }
        return value -> value;
	}

	@Override
	public MonetaryOperator getRounding(RoundingContext roundingContext){
        if(roundingContext.getRoundingId()!=null){
            return getCustomRounding(roundingContext.getRoundingId());
        }
        return new MonetaryOperator() {
            @Override
            public MonetaryAmount apply(MonetaryAmount value) {
                return value;
            }
        };
	}

Replace Anonymous With Lambda javax.money.TestRoundingProvider.getRounding.new MonetaryOperator with value -> value in method public getRounding(roundingContext RoundingContext) : MonetaryOperator from class javax.money.TestRoundingProvider


    /**
     * Get the deferred flag. Exchange rates can be deferred or real.time.
     *
     * @return the deferred flag, or {code null}.
     */
    public Set<RateType> getRateTypes(){
        return Collections.unmodifiableSet(getNamedAttribute("rateTypes", Set.class, new HashSet<>()));
    }

    /**
     * Get the deferred flag. Exchange rates can be deferred or real.time.
     *
     * @return the deferred flag, or {code null}.
     */
    public Set<RateType> getRateTypes(){
        return Collections.unmodifiableSet(getNamedAttribute("rateTypes", Set.class, new HashSet<RateType>()));
    }

Replace Generic With Diamond HashSet<RateType> with HashSet<> in method public getRateTypes() : Set<RateType> from class javax.money.convert.ProviderContext


	/**
	 * Allows to access the identifiers of the current defined custom roundings.
	 *
	 * @return the set of custom rounding ids, never {@code null}.
	 */
	public static Set<String> getCustomRoundingIds() {
		Set<String> result = new HashSet<>();
		for (RoundingProviderSpi prov : Bootstrap
				.getServices(
				RoundingProviderSpi.class)) {
			try {
				result.addAll(prov.getCustomRoundingIds());
			} catch (Exception e) {
				Logger.getLogger(MonetaryRoundings.class.getName()).log(
						Level.SEVERE,
						"Error loading RoundingProviderSpi from provider: "
								+ prov, e);
			}
		}
		return result;
	}

	/**
	 * Allows to access the identifiers of the current defined custom roundings.
	 *
	 * @return the set of custom rounding ids, never {@code null}.
	 */
	public static Set<String> getCustomRoundingIds() {
		Set<String> result = new HashSet<String>();
		for (RoundingProviderSpi prov : Bootstrap
				.getServices(
				RoundingProviderSpi.class)) {
			try {
				result.addAll(prov.getCustomRoundingIds());
			} catch (Exception e) {
				Logger.getLogger(MonetaryRoundings.class.getName()).log(
						Level.SEVERE,
						"Error loading RoundingProviderSpi from provider: "
								+ prov, e);
			}
		}
		return result;
	}

Replace Generic With Diamond HashSet<String> with HashSet<> in method public getCustomRoundingIds() : Set<String> from class javax.money.MonetaryRoundings


    public void loadCurrencies() {
		try (InputStream in = getClass().getResourceAsStream(PROP_FILE)) {
			prop.load(in);
			final String urlAddress = prop.getProperty(getClass().getSimpleName() + ".currencies");
		    URL url = new URL(urlAddress);
		    LOGGER.debug("Loading " + urlAddress);
		    SAXParser parser = saxParserFactory.newSAXParser();
		    parser.parse(url.openStream(), new CurrencyHandler());
		} catch (Exception e) {
		    LOGGER.warn("Error", e);
		}
    }

    public void loadCurrencies() {
	try {
	    URL url = new URL("http://www.currency-iso.org/dam/isocy/downloads/dl_iso_table_a1.xml");
	    SAXParser parser = saxParserFactory.newSAXParser();
	    parser.parse(url.openStream(), new CurrencyHandler());
	} catch (Exception e) {
	    LOGGER.debug("Error", e);
	}
    }

Try With Resources try(InputStream in=getClass().getResourceAsStream(PROP_FILE)) in method public loadCurrencies() : void from class net.java.javamoney.ri.ext.provider.iso.IsoCurrencyOnlineProvider


    public void loadCountries() {
    	try (InputStream in = getClass().getResourceAsStream(PROP_FILE)) {
			prop.load(in);
			final String urlAddress = prop.getProperty(getClass().getSimpleName() + ".countries");
			LOGGER.debug("Loading " + urlAddress);
		    URL url = new URL(urlAddress);
		    SAXParser parser = saxParserFactory.newSAXParser();
		    parser.parse(url.openStream(), new CountryHandler());
		} catch (Exception e) {
		    LOGGER.warn("Error", e);
		}
    }

    public void loadCountries() {
	try {
	    URL url = new URL(
		    "http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_xml.htm");
	    SAXParser parser = saxParserFactory.newSAXParser();
	    parser.parse(url.openStream(), new CountryHandler());
	} catch (Exception e) {
	    LOGGER.error("Error", e);
	}
    }

Try With Resources try(InputStream in=getClass().getResourceAsStream(PROP_FILE)) in method public loadCountries() : void from class net.java.javamoney.ri.ext.provider.iso.IsoCurrencyOnlineProvider


	/**
	 * Get the current defined properties fo this style.
	 *
	 * @return the properties defined
	 */
	public final Map<String, Object> getAttributes() {
	    return new HashMap<>(attributes);
	}

		/**
		 * Get the current defined properties fo this style.
		 *
		 * @return the properties defined
		 */
		public final Map<String, Object> getAttributes() {
			return new HashMap<String, Object>(attributes);
		}

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public getAttributes() : Map<String,Object> from class javax.money.format.LocalizationStyle.Builder


    public Configuration<T> withScaler(@NonNull Scaler scaler) {
        return new Configuration<>(mathContext, scaler, factory);
    }

    public Configuration<T> withScaler(@NonNull Scaler scaler) {
        return this.scaler == scaler ? this : new Configuration<T>(mathContext, scaler, factory);
    }

Replace Generic With Diamond Configuration<T> with Configuration<> in method public withScaler(scaler Scaler) : Configuration<T> from class com.github.honoluluhenk.fluentbigdecimals.Configuration


    public ReadableWorkbook(InputStream inputStream) throws IOException {
        try {
            pkg = OPCPackage.open(inputStream);
            reader = new XSSFReader(pkg);
            sst = reader.getSharedStringsTable();
        } catch (NotOfficeXmlFileException | OpenXML4JException e) {
            throw new ExcelReaderException(e);
        }
        factory = XMLInputFactory.newInstance();
        // To prevent XML External Entity (XXE) attacks
        factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);

        try (SimpleXmlReader workbookReader = new SimpleXmlReader(factory, reader.getWorkbookData())) {
            readWorkbook(workbookReader);
        } catch (InvalidFormatException | XMLStreamException e) {
            throw new ExcelReaderException(e);
        }
    }

    public ReadableWorkbook(InputStream inputStream) throws IOException {
        try {
            pkg = OPCPackage.open(inputStream);
            reader = new XSSFReader(pkg);
            sst = reader.getSharedStringsTable();
        } catch (NotOfficeXmlFileException e) {
            throw new ExcelReaderException(e);
        } catch (OpenXML4JException e) {
            throw new ExcelReaderException(e);
        }
        factory = XMLInputFactory.newInstance();
        // To prevent XML External Entity (XXE) attacks
        factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);

        try (SimpleXmlReader workbookReader = new SimpleXmlReader(factory, reader.getWorkbookData())) {
            readWorkbook(workbookReader);
        } catch (InvalidFormatException | XMLStreamException e) {
            throw new ExcelReaderException(e);
        }
    }

Merge Catch [catch(NotOfficeXmlFileException e), catch(OpenXML4JException e)] to catch(NotOfficeXmlFileException|OpenXML4JException e) in method public ReadableWorkbook(inputStream InputStream) from class org.dhatim.fastexcel.reader.ReadableWorkbook


  /**
   * Returns a predicate that evaluates to true if and only if the input is equivalent to {@code
   * target} according to this equivalence relation.
   *
   * @since 10.0
   */
  public final Predicate<@Nullable T> equivalentTo(@CheckForNull T target) {
    return new EquivalentToPredicate<>(this, target);
  }

  /**
   * Returns a predicate that evaluates to true if and only if the input is equivalent to {@code
   * target} according to this equivalence relation.
   *
   * @since 10.0
   */
  public final Predicate<@Nullable T> equivalentTo(@CheckForNull T target) {
    return new EquivalentToPredicate<T>(this, target);
  }

Replace Generic With Diamond EquivalentToPredicate<T> with EquivalentToPredicate<> in method public equivalentTo(target T) : Predicate<@Nullable T> from class dev.mccue.guava.base.Equivalence


/**
   * Returns an {@code Optional} instance containing the given non-null reference. To have {@code
   * null} treated as {@code #absent}, use {@code #fromNullable} instead.
   *
   *
Comparison to {@code java.util.Optional}: no differences.
   *
   * @throws NullPointerException if {@code reference} is null
   */
  public static <T> Optional<T> of(T reference) {
    return new Present<>(checkNotNull(reference));
  }

/**
   * Returns an {@code Optional} instance containing the given non-null reference. To have {@code
   * null} treated as {@code #absent}, use {@code #fromNullable} instead.
   *
   *
Comparison to {@code java.util.Optional}: no differences.
   *
   * @throws NullPointerException if {@code reference} is null
   */
  public static <T> Optional<T> of(T reference) {
    return new Present<T>(checkNotNull(reference));
  }

Replace Generic With Diamond Present<T> with Present<> in method public of(reference T) : Optional<T> from class dev.mccue.guava.base.Optional


/**
   * Returns a supplier that caches the instance supplied by the delegate and removes the cached
   * value after the specified time has passed. Subsequent calls to {@code get()} return the cached
   * value if the expiration time has not passed. After the expiration time, a new value is
   * retrieved, cached, and returned. See: memoization
   *
   *
The returned supplier is thread-safe. The supplier's serialized form does not contain the
   * cached value, which will be recalculated when {@code get()} is called on the reserialized
   * instance. The actual memoization does not happen when the underlying delegate throws an
   * exception.
   *
   *
When the underlying delegate throws an exception then this memoizing supplier will keep
   * delegating calls until it returns valid data.
   *
   * @param duration the length of time after a value is created that it should stop being returned
   *     by subsequent {@code get()} calls
   * @throws IllegalArgumentException if {@code duration} is not positive
   * @since 33.1.0
   */
  // only until we're confident that Java 8+ APIs are safe for our Android users
  // java.time.Duration
  @SuppressWarnings("Java7ApiChecker") // no more dangerous that wherever the user got the Duration
  @IgnoreJRERequirement
  public static <T extends @Nullable Object> Supplier<T> memoizeWithExpiration(
      Supplier<T> delegate, Duration duration) {
    checkNotNull(delegate);
    // The alternative of `duration.compareTo(Duration.ZERO) > 0` causes J2ObjC trouble.
    checkArgument(
        !duration.isNegative() && !duration.isZero(), "duration (%s) must be > 0", duration);
    return new ExpiringMemoizingSupplier<>(delegate, toNanosSaturated(duration));
  }

/**
   * Returns a supplier that caches the instance supplied by the delegate and removes the cached
   * value after the specified time has passed. Subsequent calls to {@code get()} return the cached
   * value if the expiration time has not passed. After the expiration time, a new value is
   * retrieved, cached, and returned. See: memoization
   *
   *
The returned supplier is thread-safe. The supplier's serialized form does not contain the
   * cached value, which will be recalculated when {@code get()} is called on the reserialized
   * instance. The actual memoization does not happen when the underlying delegate throws an
   * exception.
   *
   *
When the underlying delegate throws an exception then this memoizing supplier will keep
   * delegating calls until it returns valid data.
   *
   * @param duration the length of time after a value is created that it should stop being returned
   *     by subsequent {@code get()} calls
   * @throws IllegalArgumentException if {@code duration} is not positive
   * @since 33.1.0
   */
  // only until we're confident that Java 8+ APIs are safe for our Android users
  // java.time.Duration
  @SuppressWarnings("Java7ApiChecker") // no more dangerous that wherever the user got the Duration
  @IgnoreJRERequirement
  public static <T extends @Nullable Object> Supplier<T> memoizeWithExpiration(
      Supplier<T> delegate, Duration duration) {
    checkNotNull(delegate);
    // The alternative of `duration.compareTo(Duration.ZERO) > 0` causes J2ObjC trouble.
    checkArgument(
        !duration.isNegative() && !duration.isZero(), "duration (%s) must be > 0", duration);
    return new ExpiringMemoizingSupplier<T>(delegate, toNanosSaturated(duration));
  }

Replace Generic With Diamond ExpiringMemoizingSupplier<T> with ExpiringMemoizingSupplier<> in method public memoizeWithExpiration(delegate Supplier<T>, duration Duration) : Supplier<T> from class dev.mccue.guava.base.Suppliers


/**
   * Sets the result of this {@code Future} to match the supplied input {@code Future} once the
   * supplied {@code Future} is done, unless this {@code Future} has already been cancelled or set
   * (including "set asynchronously," defined below).
   *
   *
If the supplied future is {@code #isDone done} when this method is called and the call
   * is accepted, then this future is guaranteed to have been completed with the supplied future by
   * the time this method returns. If the supplied future is not done and the call is accepted, then
   * the future will be set asynchronously. Note that such a result, though not yet known,
   * cannot be overridden by a call to a {@code set*} method, only by a call to {@code #cancel}.
   *
   *
If the call {@code setFuture(delegate)} is accepted and this {@code Future} is later
   * cancelled, cancellation will be propagated to {@code delegate}. Additionally, any call to
   * {@code setFuture} after any cancellation will propagate cancellation to the supplied {@code
   * Future}.
   *
   *
Note that, even if the supplied future is cancelled and it causes this future to complete,
   * it will never trigger interruption behavior. In particular, it will not cause this future to
   * invoke the {@code #interruptTask} method, and the {@code #wasInterrupted} method will not
   * return {@code true}.
   *
   *
Beware of completing a future while holding a lock. Its listeners may do slow work or
   * acquire other locks, risking deadlocks.
   *
   * @param future the future to delegate to
   * @return true if the attempt was accepted, indicating that the {@code Future} was not previously
   *     cancelled or set.
   * @since 19.0
   */
  @CanIgnoreReturnValue
  protected boolean setFuture(ListenableFuture<? extends V> future) {
    checkNotNull(future);
    Object localValue = value;
    if (localValue == null) {
      if (future.isDone()) {
        Object value = getFutureValue(future);
        if (ATOMIC_HELPER.casValue(this, null, value)) {
          complete(
              this,
              /*
               * Interruption doesn't propagate through a SetFuture chain (see getFutureValue), so
               * don't invoke interruptTask.
               */
              false);
          return true;
        }
        return false;
      }
      SetFuture<V> valueToSet = new SetFuture<>(this, future);
      if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
        // the listener is responsible for calling completeWithFuture, directExecutor is appropriate
        // since all we are doing is unpacking a completed future which should be fast.
        try {
          future.addListener(valueToSet, DirectExecutor.INSTANCE);
        } catch (Throwable t) {
          // Any Exception is either a RuntimeException or sneaky checked exception.
          //
          // addListener has thrown an exception! SetFuture.run can't throw any exceptions so this
          // must have been caused by addListener itself. The most likely explanation is a
          // misconfigured mock. Try to switch to Failure.
          Failure failure;
          try {
            failure = new Failure(t);
          } catch (Exception | Error oomMostLikely) { // sneaky checked exception
            failure = Failure.FALLBACK_INSTANCE;
          }
          // Note: The only way this CAS could fail is if cancel() has raced with us. That is ok.
          boolean unused = ATOMIC_HELPER.casValue(this, valueToSet, failure);
        }
        return true;
      }
      localValue = value; // we lost the cas, fall through and maybe cancel
    }
    // The future has already been set to something. If it is cancellation we should cancel the
    // incoming future.
    if (localValue instanceof Cancellation) {
      // we don't care if it fails, this is best-effort.
      future.cancel(((Cancellation) localValue).wasInterrupted);
    }
    return false;
  }

/**
   * Sets the result of this {@code Future} to match the supplied input {@code Future} once the
   * supplied {@code Future} is done, unless this {@code Future} has already been cancelled or set
   * (including "set asynchronously," defined below).
   *
   *
If the supplied future is {@code #isDone done} when this method is called and the call
   * is accepted, then this future is guaranteed to have been completed with the supplied future by
   * the time this method returns. If the supplied future is not done and the call is accepted, then
   * the future will be set asynchronously. Note that such a result, though not yet known,
   * cannot be overridden by a call to a {@code set*} method, only by a call to {@code #cancel}.
   *
   *
If the call {@code setFuture(delegate)} is accepted and this {@code Future} is later
   * cancelled, cancellation will be propagated to {@code delegate}. Additionally, any call to
   * {@code setFuture} after any cancellation will propagate cancellation to the supplied {@code
   * Future}.
   *
   *
Note that, even if the supplied future is cancelled and it causes this future to complete,
   * it will never trigger interruption behavior. In particular, it will not cause this future to
   * invoke the {@code #interruptTask} method, and the {@code #wasInterrupted} method will not
   * return {@code true}.
   *
   *
Beware of completing a future while holding a lock. Its listeners may do slow work or
   * acquire other locks, risking deadlocks.
   *
   * @param future the future to delegate to
   * @return true if the attempt was accepted, indicating that the {@code Future} was not previously
   *     cancelled or set.
   * @since 19.0
   */
  @CanIgnoreReturnValue
  protected boolean setFuture(ListenableFuture<? extends V> future) {
    checkNotNull(future);
    Object localValue = value;
    if (localValue == null) {
      if (future.isDone()) {
        Object value = getFutureValue(future);
        if (ATOMIC_HELPER.casValue(this, null, value)) {
          complete(
              this,
              /*
               * Interruption doesn't propagate through a SetFuture chain (see getFutureValue), so
               * don't invoke interruptTask.
               */
              false);
          return true;
        }
        return false;
      }
      SetFuture<V> valueToSet = new SetFuture<V>(this, future);
      if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
        // the listener is responsible for calling completeWithFuture, directExecutor is appropriate
        // since all we are doing is unpacking a completed future which should be fast.
        try {
          future.addListener(valueToSet, DirectExecutor.INSTANCE);
        } catch (Throwable t) {
          // Any Exception is either a RuntimeException or sneaky checked exception.
          //
          // addListener has thrown an exception! SetFuture.run can't throw any exceptions so this
          // must have been caused by addListener itself. The most likely explanation is a
          // misconfigured mock. Try to switch to Failure.
          Failure failure;
          try {
            failure = new Failure(t);
          } catch (Exception | Error oomMostLikely) { // sneaky checked exception
            failure = Failure.FALLBACK_INSTANCE;
          }
          // Note: The only way this CAS could fail is if cancel() has raced with us. That is ok.
          boolean unused = ATOMIC_HELPER.casValue(this, valueToSet, failure);
        }
        return true;
      }
      localValue = value; // we lost the cas, fall through and maybe cancel
    }
    // The future has already been set to something. If it is cancellation we should cancel the
    // incoming future.
    if (localValue instanceof Cancellation) {
      // we don't care if it fails, this is best-effort.
      future.cancel(((Cancellation) localValue).wasInterrupted);
    }
    return false;
  }

Replace Generic With Diamond SetFuture<V> with SetFuture<> in method protected setFuture(future ListenableFuture<? extends V>) : boolean from class dev.mccue.guava.concurrent.AbstractFuture


  /** Creates an {@code AtomicLongMap}. */
  public static <K> AtomicLongMap<K> create() {
    return new AtomicLongMap<>(new ConcurrentHashMap<>());
  }

  /** Creates an {@code AtomicLongMap}. */
  public static <K> AtomicLongMap<K> create() {
    return new AtomicLongMap<K>(new ConcurrentHashMap<>());
  }

Replace Generic With Diamond AtomicLongMap<K> with AtomicLongMap<> in method public create() : AtomicLongMap<K> from class dev.mccue.guava.concurrent.AtomicLongMap


  /**
   * Starts a {@code ClosingFuture} pipeline with a {@code ListenableFuture}.
   *
   * <p>{@code future}'s value will not be closed when the pipeline is done even if {@code V}
   * implements {@code Closeable}. In order to start a pipeline with a value that will be closed
   * when the pipeline is done, use {@code #submit(ClosingCallable, Executor)} instead.
   */
  public static <V extends @Nullable Object> ClosingFuture<V> from(ListenableFuture<V> future) {
    return new ClosingFuture<>(future);
  }

  /**
   * Starts a {@code ClosingFuture} pipeline with a {@code ListenableFuture}.
   *
   * <p>{@code future}'s value will not be closed when the pipeline is done even if {@code V}
   * implements {@code Closeable}. In order to start a pipeline with a value that will be closed
   * when the pipeline is done, use {@code #submit(ClosingCallable, Executor)} instead.
   */
  public static <V extends @Nullable Object> ClosingFuture<V> from(ListenableFuture<V> future) {
    return new ClosingFuture<V>(future);
  }

Replace Generic With Diamond ClosingFuture<V> with ClosingFuture<> in method public from(future ListenableFuture<V>) : ClosingFuture<V> from class dev.mccue.guava.concurrent.ClosingFuture


/**
     * Creates the {@code ListenableFuture} which will return the result of calling {@code
     * AsyncCallable#call} in {@code combiner} when all futures complete, using the specified {@code
     * executor}.
     *
     *
If the combiner throws a {@code CancellationException}, the returned future will be
     * cancelled.
     *
     *
If the combiner throws an {@code ExecutionException}, the cause of the thrown {@code
     * ExecutionException} will be extracted and returned as the cause of the new {@code
     * ExecutionException} that gets thrown by the returned combined future.
     *
     *
Canceling this future will attempt to cancel all the component futures.
     *
     * @return a future whose result is based on {@code combiner} (or based on the input futures
     *     passed to {@code whenAllSucceed}, if that is the method you used to create this {@code
     *     FutureCombiner}). Even if you don't care about the value of the future, you should
     *     typically check whether it failed: See https://errorprone.info/bugpattern/FutureReturnValueIgnored.
     */
    public <C extends @Nullable Object> ListenableFuture<C> callAsync(
        AsyncCallable<C> combiner, Executor executor) {
      return new CombinedFuture<>(futures, allMustSucceed, executor, combiner);
    }

/**
     * Creates the {@code ListenableFuture} which will return the result of calling {@code
     * AsyncCallable#call} in {@code combiner} when all futures complete, using the specified {@code
     * executor}.
     *
     *
If the combiner throws a {@code CancellationException}, the returned future will be
     * cancelled.
     *
     *
If the combiner throws an {@code ExecutionException}, the cause of the thrown {@code
     * ExecutionException} will be extracted and returned as the cause of the new {@code
     * ExecutionException} that gets thrown by the returned combined future.
     *
     *
Canceling this future will attempt to cancel all the component futures.
     *
     * @return a future whose result is based on {@code combiner} (or based on the input futures
     *     passed to {@code whenAllSucceed}, if that is the method you used to create this {@code
     *     FutureCombiner}). Even if you don't care about the value of the future, you should
     *     typically check whether it failed: See https://errorprone.info/bugpattern/FutureReturnValueIgnored.
     */
    public <C extends @Nullable Object> ListenableFuture<C> callAsync(
        AsyncCallable<C> combiner, Executor executor) {
      return new CombinedFuture<C>(futures, allMustSucceed, executor, combiner);
    }

Replace Generic With Diamond CombinedFuture<C> with CombinedFuture<> in method public callAsync(combiner AsyncCallable<C>, executor Executor) : ListenableFuture<C> from class dev.mccue.guava.concurrent.Futures.FutureCombiner


/**
     * Creates the {@code ListenableFuture} which will return the result of calling {@code
     * Callable#call} in {@code combiner} when all futures complete, using the specified {@code
     * executor}.
     *
     *
If the combiner throws a {@code CancellationException}, the returned future will be
     * cancelled.
     *
     *
If the combiner throws an {@code ExecutionException}, the cause of the thrown {@code
     * ExecutionException} will be extracted and returned as the cause of the new {@code
     * ExecutionException} that gets thrown by the returned combined future.
     *
     *
Canceling this future will attempt to cancel all the component futures.
     *
     * @return a future whose result is based on {@code combiner} (or based on the input futures
     *     passed to {@code whenAllSucceed}, if that is the method you used to create this {@code
     *     FutureCombiner}). Even if you don't care about the value of the future, you should
     *     typically check whether it failed: See https://errorprone.info/bugpattern/FutureReturnValueIgnored.
     */
    public <C extends @Nullable Object> ListenableFuture<C> call(
        Callable<C> combiner, Executor executor) {
      return new CombinedFuture<>(futures, allMustSucceed, executor, combiner);
    }

/**
     * Creates the {@code ListenableFuture} which will return the result of calling {@code
     * Callable#call} in {@code combiner} when all futures complete, using the specified {@code
     * executor}.
     *
     *
If the combiner throws a {@code CancellationException}, the returned future will be
     * cancelled.
     *
     *
If the combiner throws an {@code ExecutionException}, the cause of the thrown {@code
     * ExecutionException} will be extracted and returned as the cause of the new {@code
     * ExecutionException} that gets thrown by the returned combined future.
     *
     *
Canceling this future will attempt to cancel all the component futures.
     *
     * @return a future whose result is based on {@code combiner} (or based on the input futures
     *     passed to {@code whenAllSucceed}, if that is the method you used to create this {@code
     *     FutureCombiner}). Even if you don't care about the value of the future, you should
     *     typically check whether it failed: See https://errorprone.info/bugpattern/FutureReturnValueIgnored.
     */
    public <C extends @Nullable Object> ListenableFuture<C> call(
        Callable<C> combiner, Executor executor) {
      return new CombinedFuture<C>(futures, allMustSucceed, executor, combiner);
    }

Replace Generic With Diamond CombinedFuture<C> with CombinedFuture<> in method public call(combiner Callable<C>, executor Executor) : ListenableFuture<C> from class dev.mccue.guava.concurrent.Futures.FutureCombiner


  /**
   * Returns a {@code ListenableFuture} which has an exception set immediately upon construction.
   *
   * <p>The returned {@code Future} can't be cancelled, and its {@code isDone()} method always
   * returns {@code true}. Calling {@code get()} will immediately throw the provided {@code
   * Throwable} wrapped in an {@code ExecutionException}.
   */
  public static <V extends @Nullable Object> ListenableFuture<V> immediateFailedFuture(
      Throwable throwable) {
    checkNotNull(throwable);
    return new ImmediateFailedFuture<>(throwable);
  }

  /**
   * Returns a {@code ListenableFuture} which has an exception set immediately upon construction.
   *
   * <p>The returned {@code Future} can't be cancelled, and its {@code isDone()} method always
   * returns {@code true}. Calling {@code get()} will immediately throw the provided {@code
   * Throwable} wrapped in an {@code ExecutionException}.
   */
  public static <V extends @Nullable Object> ListenableFuture<V> immediateFailedFuture(
      Throwable throwable) {
    checkNotNull(throwable);
    return new ImmediateFailedFuture<V>(throwable);
  }

Replace Generic With Diamond ImmediateFailedFuture<V> with ImmediateFailedFuture<> in method public immediateFailedFuture(throwable Throwable) : ListenableFuture<V> from class dev.mccue.guava.concurrent.Futures


  /**
   * Creates a {@code FutureCombiner} that processes the completed futures whether or not they're
   * successful.
   *
   * <p>Any failures from the input futures will not be propagated to the returned future.
   *
   * @since 20.0
   */
  @SafeVarargs
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
      ListenableFuture<? extends V>... futures) {
    return new FutureCombiner<>(false, ImmutableList.copyOf(futures));
  }

  /**
   * Creates a {@code FutureCombiner} that processes the completed futures whether or not they're
   * successful.
   *
   * <p>Any failures from the input futures will not be propagated to the returned future.
   *
   * @since 20.0
   */
  @SafeVarargs
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
      ListenableFuture<? extends V>... futures) {
    return new FutureCombiner<V>(false, ImmutableList.copyOf(futures));
  }

Replace Generic With Diamond FutureCombiner<V> with FutureCombiner<> in method public whenAllComplete(futures ListenableFuture<? extends V>...) : FutureCombiner<V> from class dev.mccue.guava.concurrent.Futures


  /**
   * Creates a {@code FutureCombiner} that processes the completed futures whether or not they're
   * successful.
   *
   * <p>Any failures from the input futures will not be propagated to the returned future.
   *
   * @since 20.0
   */
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
      Iterable<? extends ListenableFuture<? extends V>> futures) {
    return new FutureCombiner<>(false, ImmutableList.copyOf(futures));
  }

  /**
   * Creates a {@code FutureCombiner} that processes the completed futures whether or not they're
   * successful.
   *
   * <p>Any failures from the input futures will not be propagated to the returned future.
   *
   * @since 20.0
   */
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllComplete(
      Iterable<? extends ListenableFuture<? extends V>> futures) {
    return new FutureCombiner<V>(false, ImmutableList.copyOf(futures));
  }

Replace Generic With Diamond FutureCombiner<V> with FutureCombiner<> in method public whenAllComplete(futures Iterable<? extends ListenableFuture<? extends V>>) : FutureCombiner<V> from class dev.mccue.guava.concurrent.Futures


  /**
   * Creates a {@code FutureCombiner} requiring that all passed in futures are successful.
   *
   * <p>If any input fails, the returned future fails immediately.
   *
   * @since 20.0
   */
  @SafeVarargs
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
      ListenableFuture<? extends V>... futures) {
    return new FutureCombiner<>(true, ImmutableList.copyOf(futures));
  }

  /**
   * Creates a {@code FutureCombiner} requiring that all passed in futures are successful.
   *
   * <p>If any input fails, the returned future fails immediately.
   *
   * @since 20.0
   */
  @SafeVarargs
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
      ListenableFuture<? extends V>... futures) {
    return new FutureCombiner<V>(true, ImmutableList.copyOf(futures));
  }

Replace Generic With Diamond FutureCombiner<V> with FutureCombiner<> in method public whenAllSucceed(futures ListenableFuture<? extends V>...) : FutureCombiner<V> from class dev.mccue.guava.concurrent.Futures


  /**
   * Creates a {@code FutureCombiner} requiring that all passed in futures are successful.
   *
   * <p>If any input fails, the returned future fails immediately.
   *
   * @since 20.0
   */
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
      Iterable<? extends ListenableFuture<? extends V>> futures) {
    return new FutureCombiner<>(true, ImmutableList.copyOf(futures));
  }

  /**
   * Creates a {@code FutureCombiner} requiring that all passed in futures are successful.
   *
   * <p>If any input fails, the returned future fails immediately.
   *
   * @since 20.0
   */
  public static <V extends @Nullable Object> FutureCombiner<V> whenAllSucceed(
      Iterable<? extends ListenableFuture<? extends V>> futures) {
    return new FutureCombiner<V>(true, ImmutableList.copyOf(futures));
  }

Replace Generic With Diamond FutureCombiner<V> with FutureCombiner<> in method public whenAllSucceed(futures Iterable<? extends ListenableFuture<? extends V>>) : FutureCombiner<V> from class dev.mccue.guava.concurrent.Futures


    @Override
    public <V extends @Nullable Object> ListenableScheduledFuture<V> schedule(
        Callable<V> callable, long delay, TimeUnit unit) {
      TrustedListenableFutureTask<V> task = TrustedListenableFutureTask.create(callable);
      ScheduledFuture<?> scheduled = delegate.schedule(task, delay, unit);
      return new ListenableScheduledTask<>(task, scheduled);
    }

    @Override
    public <V extends @Nullable Object> ListenableScheduledFuture<V> schedule(
        Callable<V> callable, long delay, TimeUnit unit) {
      TrustedListenableFutureTask<V> task = TrustedListenableFutureTask.create(callable);
      ScheduledFuture<?> scheduled = delegate.schedule(task, delay, unit);
      return new ListenableScheduledTask<V>(task, scheduled);
    }

Replace Generic With Diamond ListenableScheduledTask<V> with ListenableScheduledTask<> in method public schedule(callable Callable<V>, delay long, unit TimeUnit) : ListenableScheduledFuture<V> from class dev.mccue.guava.concurrent.MoreExecutors.ScheduledListeningDecorator


	@SuppressWarnings("restriction")
	public void initMainMenu(Stage stage) {
		System.setProperty("sampler.mode", "true");
	   //logger.info("MainMenu's initAndShowGUI() is on " + Thread.currentThread().getName());
		this.primaryStage = stage;

    	Platform.setImplicitExit(false);
		// Note: If this attribute is true, the JavaFX runtime will implicitly shutdown when the last window is closed;
		// the JavaFX launcher will call the Application.stop method and terminate the JavaFX application thread.
		// If this attribute is false, the application will continue to run normally even after the last window is closed,
		// until the application calls exit. The default value is true.

    	menuApp = new MenuApp(mainMenu);
    	anchorPane = menuApp.createContent();

    	stackPane = new StackPane(anchorPane);
    	stackPane.setPrefSize(WIDTH, HEIGHT);
    	stackPane.setLayoutX(10);
    	stackPane.setLayoutY(10);

    	double sceneWidth = stackPane.getPrefWidth() + 30;
    	double sceneHeight = stackPane.getPrefHeight() + 30;

    	// Create application area
    	@SuppressWarnings("restriction")
    	Rectangle applicationArea = RectangleBuilder.create()
                .width(sceneWidth - 10)
                .height(sceneHeight - 10)
                .arcWidth(20)
                .arcHeight(20)
                .fill(Color.rgb(0, 0, 0, .80))
                .x(0)
                .y(0)
                .strokeWidth(2)
                .stroke(Color.rgb(255, 255, 255, .70))
                .build();

    	// Create close button
    	final Group closeApp = new Group();
    	Node closeRect = RectangleBuilder.create()
               .width(25)
               .height(25)
               .arcWidth(15)
               .arcHeight(15)
               .fill(Color.rgb(0, 0, 0, .80))
               .stroke(Color.WHITE)
               .build();

    	Text closeXmark = new Text(9, 16.5, "X");
    	closeXmark.setStroke( Color.WHITE);
    	closeXmark.setFill(Color.WHITE);
    	closeXmark.setStrokeWidth(2);
    	closeApp.setTranslateY(5);
    	closeApp.getChildren().addAll(closeRect, closeXmark);
    	closeApp.setOnMouseClicked(new EventHandler<MouseEvent>() {
       	@Override
       	public void handle(MouseEvent event) {
       		if (!isShowingDialog) {
       			dialogOnExit(rootPane);
       		}
       		if (!isExit) {
       			event.consume();
       		}
       		else {
       			Platform.exit();
           		System.exit(0);
       		}
       	}
       });

       rootPane = new StackPane();
       rootPane.setPrefSize(stackPane.getPrefWidth()-300, stackPane.getPrefHeight());//stackPane.getPrefWidth()-50, stackPane.getPrefHeight()-50);
       //rootPane.setLayoutX((sceneWidth-stackPane.getPrefWidth()));
       //rootPane.setLayoutY((sceneHeight-stackPane.getPrefHeight()));

       Group root = new Group();
       root.getChildren().add(applicationArea);
       root.getChildren().add(stackPane);
       root.getChildren().add(closeApp);
       root.getChildren().add(rootPane);

       Scene scene = new Scene(root, sceneWidth, sceneHeight, Color.rgb(0, 0, 0, 0));

       closeApp.translateXProperty().bind(scene.widthProperty().subtract(40));

       // starting initial anchor point
       scene.setOnMousePressed(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent event){
                anchorPt = new Point2D(event.getScreenX(), event.getScreenY());
            }
        });

        // dragging the entire stage
        scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent event){
                if (anchorPt != null && previousLocation != null) {
                    primaryStage.setX(previousLocation.getX() + event.getScreenX() - anchorPt.getX());
                    primaryStage.setY(previousLocation.getY() + event.getScreenY() - anchorPt.getY());
                }
            }
        });

        // set the current location
        scene.setOnMouseReleased(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent event){
                previousLocation = new Point2D(primaryStage.getX(), primaryStage.getY());
            }
        });

        previousLocation = new Point2D(primaryStage.getX(), primaryStage.getY());

	   //scene = new Scene(stackPane, WIDTH, HEIGHT, true, SceneAntialiasing.BALANCED); // Color.DARKGOLDENROD, Color.TAN);//MAROON); //TRANSPARENT);//DARKGOLDENROD);
        // Add keyboard control
        menuApp.getSpinningGlobe().getGlobe().handleKeyboard(scene);
       // Add mouse control
        menuApp.getSpinningGlobe().getGlobe().handleMouse(scene);

       //scene.setFill(Color.BLACK);//DARKGOLDENROD);//Color.BLACK);

        scene.getStylesheets().add(this.getClass().getResource("/fxui/css/mainmenu.css").toExternalForm());
       //mainMenuScene.setFill(Color.BLACK); // if using Group, a black border will remain
       //mainMenuScene.setFill(Color.TRANSPARENT); // if using Group, a white border will remain
        scene.setCursor(Cursor.HAND);

       // Makes the menu option box fades in
        scene.setOnMouseEntered(new EventHandler<MouseEvent>(){
           public void handle(MouseEvent mouseEvent){
        	   menuApp.startAnimation();
               FadeTransition fadeTransition
                       = new FadeTransition(Duration.millis(1000), menuApp.getOptionMenu());
               fadeTransition.setFromValue(0.0);
               fadeTransition.setToValue(1.0);
               fadeTransition.play();
           }
        });

       // Makes the menu option box fades out
        scene.setOnMouseExited(new EventHandler<MouseEvent>(){
           public void handle(MouseEvent mouseEvent){
        	   menuApp.endAnimation();
               FadeTransition fadeTransition
                       = new FadeTransition(Duration.millis(1000), menuApp.getOptionMenu());
               fadeTransition.setFromValue(1.0);
               fadeTransition.setToValue(0.0);
               fadeTransition.play();
        	   fadeTransition.setOnFinished(e -> menuApp.clearMenuItems());
           }
        });

       primaryStage.setOnCloseRequest(e -> {
    		if (!isShowingDialog) {
    			dialogOnExit(rootPane);
    		}
    		if (!isExit) {
    			e.consume();
    		}
    		else {
    			Platform.exit();
        		System.exit(0);
    		}
        });

       //primaryStage.setResizable(false);
       //primaryStage.setTitle(Simulation.title);
       primaryStage.getIcons().add(new Image(this.getClass().getResource("/icons/lander_hab64.png").toExternalForm()));
       //NOTE: OR use svg file with stage.getIcons().add(new Image(this.getClass().getResource("/icons/lander_hab.svg").toString()));
       primaryStage.setScene(scene);

       setMonitor(stage);

       primaryStage.centerOnScreen();
       primaryStage.initStyle(StageStyle.TRANSPARENT);
       primaryStage.show();

   }

	@SuppressWarnings("restriction")
	public void initMainMenu(Stage stage) {
		System.setProperty("sampler.mode", "true");
	   //logger.info("MainMenu's initAndShowGUI() is on " + Thread.currentThread().getName());
		this.primaryStage = stage;

    	Platform.setImplicitExit(false);
		// Note: If this attribute is true, the JavaFX runtime will implicitly shutdown when the last window is closed;
		// the JavaFX launcher will call the Application.stop method and terminate the JavaFX application thread.
		// If this attribute is false, the application will continue to run normally even after the last window is closed,
		// until the application calls exit. The default value is true.

    	menuApp = new MenuApp(mainMenu);
    	anchorPane = menuApp.createContent();

    	stackPane = new StackPane(anchorPane);
    	stackPane.setPrefSize(WIDTH, HEIGHT);
    	stackPane.setLayoutX(10);
    	stackPane.setLayoutY(10);

    	double sceneWidth = stackPane.getPrefWidth() + 30;
    	double sceneHeight = stackPane.getPrefHeight() + 30;

    	// Create application area
    	@SuppressWarnings("restriction")
    	Rectangle applicationArea = RectangleBuilder.create()
                .width(sceneWidth - 10)
                .height(sceneHeight - 10)
                .arcWidth(20)
                .arcHeight(20)
                .fill(Color.rgb(0, 0, 0, .80))
                .x(0)
                .y(0)
                .strokeWidth(2)
                .stroke(Color.rgb(255, 255, 255, .70))
                .build();

    	// Create close button
    	final Group closeApp = new Group();
    	Node closeRect = RectangleBuilder.create()
               .width(25)
               .height(25)
               .arcWidth(15)
               .arcHeight(15)
               .fill(Color.rgb(0, 0, 0, .80))
               .stroke(Color.WHITE)
               .build();

    	Text closeXmark = new Text(9, 16.5, "X");
    	closeXmark.setStroke( Color.WHITE);
    	closeXmark.setFill(Color.WHITE);
    	closeXmark.setStrokeWidth(2);
    	closeApp.setTranslateY(5);
    	closeApp.getChildren().addAll(closeRect, closeXmark);
    	closeApp.setOnMouseClicked(new EventHandler<MouseEvent>() {
       	@Override
       	public void handle(MouseEvent event) {
       		if (!isShowingDialog) {
       			dialogOnExit(stackPane);
       		}
       		if (!isExit) {
       			event.consume();
       		}
       		else {
       			Platform.exit();
           		System.exit(0);
       		}
       	}
       });

       Group root = new Group();
       root.getChildren().add(applicationArea);
       root.getChildren().add(stackPane);
       root.getChildren().add(closeApp);

       Scene scene = new Scene(root, sceneWidth, sceneHeight, Color.rgb(0, 0, 0, 0));

       closeApp.translateXProperty().bind(scene.widthProperty().subtract(40));

       // starting initial anchor point
       scene.setOnMousePressed(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent event){
                anchorPt = new Point2D(event.getScreenX(), event.getScreenY());
            }
        });

        // dragging the entire stage
        scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent event){
                if (anchorPt != null && previousLocation != null) {
                    primaryStage.setX(previousLocation.getX() + event.getScreenX() - anchorPt.getX());
                    primaryStage.setY(previousLocation.getY() + event.getScreenY() - anchorPt.getY());
                }
            }
        });

        // set the current location
        scene.setOnMouseReleased(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent event){
                previousLocation = new Point2D(primaryStage.getX(), primaryStage.getY());
            }
        });

        previousLocation = new Point2D(primaryStage.getX(), primaryStage.getY());

	   //scene = new Scene(stackPane, WIDTH, HEIGHT, true, SceneAntialiasing.BALANCED); // Color.DARKGOLDENROD, Color.TAN);//MAROON); //TRANSPARENT);//DARKGOLDENROD);
        // Add keyboard control
        menuApp.getSpinningGlobe().getGlobe().handleKeyboard(scene);
       // Add mouse control
        menuApp.getSpinningGlobe().getGlobe().handleMouse(scene);

       //scene.setFill(Color.BLACK);//DARKGOLDENROD);//Color.BLACK);

        scene.getStylesheets().add(this.getClass().getResource("/fxui/css/mainmenu.css").toExternalForm());
       //mainMenuScene.setFill(Color.BLACK); // if using Group, a black border will remain
       //mainMenuScene.setFill(Color.TRANSPARENT); // if using Group, a white border will remain
        scene.setCursor(Cursor.HAND);

       // Makes the menu option box fades in
        scene.setOnMouseEntered(new EventHandler<MouseEvent>(){
           public void handle(MouseEvent mouseEvent){
        	   menuApp.startAnimation();
               FadeTransition fadeTransition
                       = new FadeTransition(Duration.millis(1000), menuApp.getOptionMenu());
               fadeTransition.setFromValue(0.0);
               fadeTransition.setToValue(1.0);
               fadeTransition.play();
           }
        });

       // Makes the menu option box fades out
        scene.setOnMouseExited(new EventHandler<MouseEvent>(){
           public void handle(MouseEvent mouseEvent){
        	   menuApp.endAnimation();
               FadeTransition fadeTransition
                       = new FadeTransition(Duration.millis(1000), menuApp.getOptionMenu());
               fadeTransition.setFromValue(1.0);
               fadeTransition.setToValue(0.0);
               fadeTransition.play();
        	   fadeTransition.setOnFinished(e -> menuApp.clearMenuItems());
           }
        });

       primaryStage.setOnCloseRequest(e -> {
    		if (!isShowingDialog) {
    			dialogOnExit(stackPane);
    		}
    		if (!isExit) {
    			e.consume();
    		}
    		else {
    			Platform.exit();
        		System.exit(0);
    		}
        });

       //primaryStage.setResizable(false);
       //primaryStage.setTitle(Simulation.title);
       primaryStage.getIcons().add(new Image(this.getClass().getResource("/icons/lander_hab64.png").toExternalForm()));
       //NOTE: OR use svg file with stage.getIcons().add(new Image(this.getClass().getResource("/icons/lander_hab.svg").toString()));
       primaryStage.setScene(scene);

       setMonitor(stage);

       primaryStage.centerOnScreen();
       primaryStage.initStyle(StageStyle.TRANSPARENT);
       primaryStage.show();

   }

Replace Anonymous With Lambda org.mars_sim.msp.ui.javafx.mainmenu.MainMenu.initMainMenu.setOnMouseClicked.new EventHandler<MouseEvent> with e -> {if(!isShowingDialog){dialogOnExit(rootPane); in method public initMainMenu(stage Stage) : void from class org.mars_sim.msp.ui.javafx.mainmenu.MainMenu


	public void createCommitButton() {
		commitButton = new JFXButton("Commit Change");//SubmitButton();
		commitButton.setOnAction(e -> { //setOnMousePressed(e -> {

            commitObjective();
/*
        	if (!running) {
        		timer.start();
                running = true;
                commitButton.setDisable(true);
        	}

        	e.consume();
*/
		});

		commitButton.setId("commit-button");
		commitButton.setMaxWidth(150);
		commitButton.setAlignment(Pos.CENTER);

		//commitButton.statusProperty().addListener(o -> System.out.println(commitButton.getStatus()));
/*
		progress = 0;
		lastTimerCall = System.nanoTime();
		timer = new AnimationTimer() {
			@Override
			public void handle(long now) {
                if (now > lastTimerCall + 2_000l) {
					progress += 0.005;
					commitButton.setProgress(progress);
					lastTimerCall = now;

                    if (toggle) {
                        if (progress > 0.75) {
                            progress = 0;
                            commitButton.setFailed();
                            timer.stop();
                            running = false;
                            toggle ^= true;
                            commitButton.setDisable(false);
                            // reset back to the old objective
                            resetButton();
                        }

                    } else {
                        if (progress > 1) {
                            progress = 0;
                            commitButton.setSuccess();
                            timer.stop();
                            running = false;
                            toggle ^= true;
                            commitButton.setDisable(false);
                            // set to the new objective
                            commitObjective();
                        }
                    }
				}
			}
		};
*/
	}

	public void createCommitButton() {
		commitButton = new SubmitButton();
		commitButton.setOnMousePressed(e -> {
        	if (!running) {
        		timer.start();
                running = true;
                commitButton.setDisable(true);
        	}

        	e.consume();
		});

		commitButton.statusProperty().addListener(o -> System.out.println(commitButton.getStatus()));

		progress = 0;
		lastTimerCall = System.nanoTime();
		timer = new AnimationTimer() {
			@Override
			public void handle(long now) {
                if (now > lastTimerCall + 2_000l) {
					progress += 0.005;
					commitButton.setProgress(progress);
					lastTimerCall = now;

                    if (toggle) {
                        if (progress > 0.75) {
                            progress = 0;
                            commitButton.setFailed();
                            timer.stop();
                            running = false;
                            toggle ^= true;
                            commitButton.setDisable(false);
                            // reset back to the old objective
                            resetButton();
                        }

                    } else {
                        if (progress > 1) {
                            progress = 0;
                            commitButton.setSuccess();
                            timer.stop();
                            running = false;
                            toggle ^= true;
                            commitButton.setDisable(false);
                            // set to the new objective
                            commitObjective();
                        }
                    }
				}
			}
		};
	}

Replace Anonymous With Lambda org.mars_sim.msp.ui.swing.unit_window.structure.TabPanelDashboard.createCommitButton.new AnimationTimer with e -> {commitObjective(); in method public createCommitButton() : void from class org.mars_sim.msp.ui.swing.unit_window.structure.TabPanelDashboard