Skip to content

Commit

Permalink
JavaDoc fixes (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
tginsberg authored Nov 17, 2024
1 parent 7ec0c9e commit cbc9487
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 27 deletions.
16 changes: 8 additions & 8 deletions src/main/java/com/ginsberg/gatherers4j/DistinctGatherer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
import java.util.function.Supplier;
import java.util.stream.Gatherer;

public class DistinctGatherer<INPUT, MAPPED>
implements Gatherer<INPUT, DistinctGatherer.State<MAPPED>, INPUT> {
public class DistinctGatherer<INPUT>
implements Gatherer<INPUT, DistinctGatherer.State, INPUT> {

private final Function<INPUT, MAPPED> byFunction;
private final Function<INPUT, Object> byFunction;

DistinctGatherer(final Function<INPUT, MAPPED> byFunction) {
DistinctGatherer(final Function<INPUT, Object> byFunction) {
Objects.requireNonNull(byFunction, "Mapping function must not be null");
this.byFunction = byFunction;
}

@Override
public Supplier<State<MAPPED>> initializer() {
public Supplier<State> initializer() {
return State::new;
}

@Override
public Integrator<DistinctGatherer.State<MAPPED>, INPUT, INPUT> integrator() {
public Integrator<DistinctGatherer.State, INPUT, INPUT> integrator() {
return (state, element, downstream) -> {
if (state.knownObjects.add(byFunction.apply(element))) {
downstream.push(element);
Expand All @@ -48,7 +48,7 @@ public Integrator<DistinctGatherer.State<MAPPED>, INPUT, INPUT> integrator() {
};
}

public static class State<MAPPED> {
final Set<MAPPED> knownObjects = new HashSet<>();
public static class State {
final Set<Object> knownObjects = new HashSet<>();
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/ginsberg/gatherers4j/GathererUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package com.ginsberg.gatherers4j;

public class GathererUtils {
abstract class GathererUtils {

public static long NANOS_PER_MILLISECOND = 1_000_000;
static long NANOS_PER_MILLISECOND = 1_000_000;

static boolean safeEquals(final Object left, final Object right) {
if (left == null && right == null) {
Expand Down
Loading

0 comments on commit cbc9487

Please sign in to comment.