Skip to content

Commit

Permalink
(refactor) Use Java 8 Streams, not Guava
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanMartinez committed Dec 4, 2016
1 parent 789b721 commit 949e8da
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
*/
package org.testfx.util;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import javafx.geometry.Bounds;
import javafx.scene.Node;
Expand Down Expand Up @@ -68,36 +70,36 @@ public static Set<Node> rootsOfWindows(Collection<Window> windows) {
*/
public static Set<Node> rootOfWindow(Window... windows) {
// TODO: is this set (toSet()) in order?
return FluentIterable.from(ImmutableList.copyOf(windows))
.<Node>transform((window) -> fromWindow(window))
.toSet();
return Arrays.stream(windows)
.map(NodeQueryUtils::fromWindow)
.collect(Collectors.toSet());
}

/**
* Returns a set of the given stages' scenes' root nodes
*/
public static Set<Node> rootOfStage(Stage... stages) {
return FluentIterable.from(ImmutableList.copyOf(stages))
.<Node>transform((stage) -> fromStage(stage))
.toSet();
return Arrays.stream(stages)
.map(NodeQueryUtils::fromStage)
.collect(Collectors.toSet());
}

/**
* Returns a set of the given scenes' root nodes
*/
public static Set<Node> rootOfScene(Scene... scenes) {
return FluentIterable.from(ImmutableList.copyOf(scenes))
.<Node>transform((scene) -> fromScene(scene))
.toSet();
return Arrays.stream(scenes)
.map(NodeQueryUtils::fromScene)
.collect(Collectors.toSet());
}

/**
* Returns a set of the given popup controls' scenes' root nodes
*/
public static Set<Node> rootOfPopupControl(PopupControl... popupControls) {
return FluentIterable.from(ImmutableList.copyOf(popupControls))
.<Node>transform((popupControl) -> fromPopupControl(popupControl))
.toSet();
return Arrays.stream(popupControls)
.map(NodeQueryUtils::fromPopupControl)
.collect(Collectors.toSet());
}

/**
Expand Down

0 comments on commit 949e8da

Please sign in to comment.