Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
amaembo committed Oct 17, 2017
1 parent 64b8767 commit 436853d
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/main/java/one/util/streamex/CrossSpliterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ boolean advance(int i) {
if (i == 0 || collections[i - 1] == null || !advance(i - 1))
return false;
spliterators[i] = collections[i].spliterator();
if (!spliterators[i].tryAdvance(action))
return false;
return spliterators[i].tryAdvance(action);
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/one/util/streamex/Joining.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
*/
public class Joining extends CancellableCollector<CharSequence, Joining.Accumulator, String> {
static final class Accumulator {
List<CharSequence> data = new ArrayList<>();
final List<CharSequence> data = new ArrayList<>();
int chars = 0, count = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/one/util/streamex/PairSpliterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
static final int MODE_MAP_FIRST_OR_ELSE = 3;
static final int MODE_MAP_LAST_OR_ELSE = 4;

static Sink<?> EMPTY = new Sink<>(null);
static final Sink<?> EMPTY = new Sink<>(null);
// Common lock for all the derived spliterators
final Object lock = new Object();
final int mode;
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/one/util/streamex/StreamExInternals.java
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,6 @@ static <T> PairBox<T, T> single(T a) {
return new PairBox<>(a, a);
}

public void setB(B b) {
this.b = b;
}

@Override
public int hashCode() {
return b == null ? 0 : b.hashCode();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/one/util/streamex/CustomPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class CustomPoolTest {
ForkJoinPool pool = new ForkJoinPool(3);
final ForkJoinPool pool = new ForkJoinPool(3);

private void checkThread(Object element) {
Thread thread = Thread.currentThread();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/one/util/streamex/LongStreamExTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LongStreamExTest {
LongConsumer EMPTY = l -> {
final LongConsumer EMPTY = l -> {
// nothing
};

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/one/util/streamex/MoreCollectorsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MoreCollectorsTest {
static class MyNumber implements Comparable<MyNumber> {
int value;
final int value;

MyNumber(int value) {
this.value = value;
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/one/util/streamex/StreamExTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class StreamExTest {
@Rule
public TemporaryFolder tmp = new TemporaryFolder();
public final TemporaryFolder tmp = new TemporaryFolder();

@Test
public void testCreate() {
Expand All @@ -97,7 +97,7 @@ public void testCreate() {
assertEquals(asList((String) null), StreamEx.of((String) null).toList());
assertEquals(asList("a", "b"), StreamEx.of("a", "b").toList());
assertEquals(asList("a", "b"), StreamEx.of(asList("a", "b")).toList());
assertEquals(asList("a", "b"), StreamEx.of(asList("a", "b").stream()).toList());
assertEquals(asList("a", "b"), StreamEx.of(Stream.of("a", "b")).toList());
assertEquals(asList("a", "b"), StreamEx.split("a,b", ",").toList());
assertEquals(asList("a", "c", "d"), StreamEx.split("abcBd", Pattern.compile("b", Pattern.CASE_INSENSITIVE))
.toList());
Expand Down Expand Up @@ -499,7 +499,7 @@ public void testFlatArray() {
public void testAppend() {
assertEquals(asList("a", "b", "c", "d", "e"), StreamEx.of("a", "b", "c", "dd").remove(s -> s.length() > 1)
.append("d", "e").toList());
assertEquals(asList("a", "b", "c", "d", "e"), StreamEx.of("a", "b", "c").append(asList("d", "e").stream())
assertEquals(asList("a", "b", "c", "d", "e"), StreamEx.of("a", "b", "c").append(Stream.of("d", "e"))
.toList());
assertEquals(asList("a", "b", "c", "d", "e"), StreamEx.of("a", "b", "c").append(asList("d", "e")).toList());

Expand All @@ -522,7 +522,7 @@ public void testPrepend() {
streamEx(supplier, s -> {
assertEquals(asList("d", "e", "a", "b", "c"), s.get().remove(str -> str.length() > 1).prepend("d", "e")
.toList());
assertEquals(asList("d", "e", "a", "b", "c", "dd"), s.get().prepend(asList("d", "e").stream())
assertEquals(asList("d", "e", "a", "b", "c", "dd"), s.get().prepend(Stream.of("d", "e"))
.toList());
assertEquals(asList("d", "e", "a", "b", "c", "dd"), s.get().prepend(asList("d", "e")).toList());
});
Expand Down Expand Up @@ -787,7 +787,7 @@ private <T extends Comparable<? super T>> Optional<T> firstMisplaced(Collection<
}

static class Point {
double x, y;
final double x, y;

Point(double x, double y) {
this.x = x;
Expand Down Expand Up @@ -901,7 +901,7 @@ public void testPairMapAddHeaders() {

static class Node {
Node parent;
String name;
final String name;

public Node(String name) {
this.name = name;
Expand Down Expand Up @@ -964,7 +964,7 @@ public void testPermutations() {
}

static class TreeNode {
String title;
final String title;

public TreeNode(String title) {
this.title = title;
Expand All @@ -981,7 +981,7 @@ public StreamEx<TreeNode> flatStream() {
}

static class CompositeNode extends TreeNode {
List<TreeNode> nodes = new ArrayList<>();
final List<TreeNode> nodes = new ArrayList<>();

public CompositeNode(String title) {
super(title);
Expand Down

0 comments on commit 436853d

Please sign in to comment.