Skip to content

Commit

Permalink
0.9.77
Browse files Browse the repository at this point in the history
  • Loading branch information
landawn committed Jul 31, 2017
1 parent aa69d10 commit c9e4467
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 81 deletions.
6 changes: 4 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

========Changes in 0.9.77=========================================================================

1*, change the return types of sumInt/sumLong/sumDouble from Long/Long/Double/ to int/long/double.
1*, Change the return types of sumInt/sumLong/sumDouble from Long/Long/Double/ to int/long/double.

2, Improvements and bug fix.
2*, Remove averagingInt2OrGet/averagingInt2OrThrow/averagingLong2OrGet/averagingLong2OrThrow/averagingDouble2OrGet/averagingDouble2OrThrow from Collectors.

3, Improvements and bug fix.


========Changes in 0.9.76=========================================================================
Expand Down
Binary file modified lib/abacus-util-0.9.77.jar
Binary file not shown.
Binary file modified lib/abacus-util-all-0.9.77.jar
Binary file not shown.
Binary file modified lib/abacus-util-all-jdk7-0.9.77.jar
Binary file not shown.
Binary file modified lib/abacus-util-jdk7-0.9.77.jar
Binary file not shown.
157 changes: 78 additions & 79 deletions src/com/landawn/abacus/util/stream/Collectors.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
import com.landawn.abacus.util.function.BiPredicate;
import com.landawn.abacus.util.function.BinaryOperator;
import com.landawn.abacus.util.function.Consumer;
import com.landawn.abacus.util.function.DoubleSupplier;
import com.landawn.abacus.util.function.Function;
import com.landawn.abacus.util.function.Predicate;
import com.landawn.abacus.util.function.Supplier;
Expand Down Expand Up @@ -2418,32 +2417,32 @@ public OptionalDouble apply(long[] a) {
return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}

public static <T> Collector<T, ?, Double> averagingInt2OrGet(final ToIntFunction<? super T> mapper, final DoubleSupplier other) {
final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingInt2(mapper);

final Function<long[], Double> finisher = new Function<long[], Double>() {
@Override
public Double apply(long[] a) {
return collector.finisher().apply(a).orGet(other);
}
};

return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}

public static <T, X extends RuntimeException> Collector<T, ?, Double> averagingInt2OrThrow(final ToIntFunction<? super T> mapper,
final Supplier<? extends X> exceptionSupplier) {
final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingInt2(mapper);

final Function<long[], Double> finisher = new Function<long[], Double>() {
@Override
public Double apply(long[] a) {
return collector.finisher().apply(a).orThrow(exceptionSupplier);
}
};

return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}
// public static <T> Collector<T, ?, Double> averagingInt2OrGet(final ToIntFunction<? super T> mapper, final DoubleSupplier other) {
// final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingInt2(mapper);
//
// final Function<long[], Double> finisher = new Function<long[], Double>() {
// @Override
// public Double apply(long[] a) {
// return collector.finisher().apply(a).orGet(other);
// }
// };
//
// return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
// }
//
// public static <T, X extends RuntimeException> Collector<T, ?, Double> averagingInt2OrThrow(final ToIntFunction<? super T> mapper,
// final Supplier<? extends X> exceptionSupplier) {
// final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingInt2(mapper);
//
// final Function<long[], Double> finisher = new Function<long[], Double>() {
// @Override
// public Double apply(long[] a) {
// return collector.finisher().apply(a).orThrow(exceptionSupplier);
// }
// };
//
// return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
// }

/**
* Returns a {@code Collector} that produces the arithmetic mean of a long-valued
Expand Down Expand Up @@ -2506,32 +2505,32 @@ public OptionalDouble apply(long[] a) {
return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}

public static <T> Collector<T, ?, Double> averagingLong2OrGet(final ToLongFunction<? super T> mapper, final DoubleSupplier other) {
final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingLong2(mapper);

final Function<long[], Double> finisher = new Function<long[], Double>() {
@Override
public Double apply(long[] a) {
return collector.finisher().apply(a).orGet(other);
}
};

return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}

public static <T, X extends RuntimeException> Collector<T, ?, Double> averagingLong2OrThrow(final ToLongFunction<? super T> mapper,
final Supplier<? extends X> exceptionSupplier) {
final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingLong2(mapper);

final Function<long[], Double> finisher = new Function<long[], Double>() {
@Override
public Double apply(long[] a) {
return collector.finisher().apply(a).orThrow(exceptionSupplier);
}
};

return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}
// public static <T> Collector<T, ?, Double> averagingLong2OrGet(final ToLongFunction<? super T> mapper, final DoubleSupplier other) {
// final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingLong2(mapper);
//
// final Function<long[], Double> finisher = new Function<long[], Double>() {
// @Override
// public Double apply(long[] a) {
// return collector.finisher().apply(a).orGet(other);
// }
// };
//
// return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
// }
//
// public static <T, X extends RuntimeException> Collector<T, ?, Double> averagingLong2OrThrow(final ToLongFunction<? super T> mapper,
// final Supplier<? extends X> exceptionSupplier) {
// final Collector<T, long[], OptionalDouble> collector = (Collector<T, long[], OptionalDouble>) averagingLong2(mapper);
//
// final Function<long[], Double> finisher = new Function<long[], Double>() {
// @Override
// public Double apply(long[] a) {
// return collector.finisher().apply(a).orThrow(exceptionSupplier);
// }
// };
//
// return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
// }

/**
* Returns a {@code Collector} that produces the arithmetic mean of a double-valued
Expand Down Expand Up @@ -2624,32 +2623,32 @@ public OptionalDouble apply(double[] a) {
return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}

public static <T> Collector<T, ?, Double> averagingDouble2OrGet(final ToDoubleFunction<? super T> mapper, final DoubleSupplier other) {
final Collector<T, double[], OptionalDouble> collector = (Collector<T, double[], OptionalDouble>) averagingDouble2(mapper);

final Function<double[], Double> finisher = new Function<double[], Double>() {
@Override
public Double apply(double[] a) {
return collector.finisher().apply(a).orGet(other);
}
};

return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}

public static <T, X extends RuntimeException> Collector<T, ?, Double> averagingDouble2OrThrow(final ToDoubleFunction<? super T> mapper,
final Supplier<? extends X> exceptionSupplier) {
final Collector<T, double[], OptionalDouble> collector = (Collector<T, double[], OptionalDouble>) averagingDouble2(mapper);

final Function<double[], Double> finisher = new Function<double[], Double>() {
@Override
public Double apply(double[] a) {
return collector.finisher().apply(a).orThrow(exceptionSupplier);
}
};

return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
}
// public static <T> Collector<T, ?, Double> averagingDouble2OrGet(final ToDoubleFunction<? super T> mapper, final DoubleSupplier other) {
// final Collector<T, double[], OptionalDouble> collector = (Collector<T, double[], OptionalDouble>) averagingDouble2(mapper);
//
// final Function<double[], Double> finisher = new Function<double[], Double>() {
// @Override
// public Double apply(double[] a) {
// return collector.finisher().apply(a).orGet(other);
// }
// };
//
// return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
// }
//
// public static <T, X extends RuntimeException> Collector<T, ?, Double> averagingDouble2OrThrow(final ToDoubleFunction<? super T> mapper,
// final Supplier<? extends X> exceptionSupplier) {
// final Collector<T, double[], OptionalDouble> collector = (Collector<T, double[], OptionalDouble>) averagingDouble2(mapper);
//
// final Function<double[], Double> finisher = new Function<double[], Double>() {
// @Override
// public Double apply(double[] a) {
// return collector.finisher().apply(a).orThrow(exceptionSupplier);
// }
// };
//
// return new CollectorImpl<>(collector.supplier(), collector.accumulator(), collector.combiner(), finisher, CH_NOID);
// }

// public static <T> Collector<T, ?, DataSet> toDataSet(final String entityName, final Class<?> entityClass, final List<String> columnNames) {
// @SuppressWarnings("rawtypes")
Expand Down

0 comments on commit c9e4467

Please sign in to comment.