Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Migrate empty arrays from CollectionUtil to ArrayTypeUtils #5748

Merged
merged 6 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//
package io.deephaven.benchmarking.generator;

import io.deephaven.datastructures.util.CollectionUtil;
import io.deephaven.benchmarking.generator.random.ExtendedRandom;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -50,7 +49,7 @@ public void init(@NotNull ExtendedRandom random) {
enums.add(super.get());
}

enumVals = enums.toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY);
enumVals = enums.toArray(String[]::new);
}

public String get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,27 @@
*/
public class CollectionUtil {

public static final byte[] ZERO_LENGTH_BYTE_ARRAY = new byte[0];
@Deprecated(forRemoval = true)
public static final short[] ZERO_LENGTH_SHORT_ARRAY = new short[0];
@Deprecated(forRemoval = true)
public static final byte[] ZERO_LENGTH_BYTE_ARRAY = new byte[0];
@Deprecated(forRemoval = true)
public static final int[] ZERO_LENGTH_INT_ARRAY = new int[0];
@Deprecated(forRemoval = true)
public static final int[][] ZERO_LENGTH_INT_ARRAY_ARRAY = new int[0][];
@Deprecated(forRemoval = true)
public static final long[] ZERO_LENGTH_LONG_ARRAY = new long[0];
@Deprecated(forRemoval = true)
public static final float[] ZERO_LENGTH_FLOAT_ARRAY = new float[0];
@Deprecated(forRemoval = true)
public static final double[] ZERO_LENGTH_DOUBLE_ARRAY = new double[0];
@Deprecated(forRemoval = true)
public static final double[][] ZERO_LENGTH_DOUBLE_ARRAY_ARRAY = new double[0][];
@Deprecated(forRemoval = true)
public static final Object[] ZERO_LENGTH_OBJECT_ARRAY = new Object[0];
@Deprecated(forRemoval = true)
public static final String[] ZERO_LENGTH_STRING_ARRAY = new String[0];
@Deprecated(forRemoval = true)
public static final String[][] ZERO_LENGTH_STRING_ARRAY_ARRAY = new String[0][];

// ----------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ private static String createMultiSeriesArgs(JavaFunction f) {
final String[] names = f.getParameterNames();
String args = String.join(", ", names);
if (!names[names.length - 1].equals("keys")) {
args += ", io.deephaven.datastructures.util.CollectionUtil.ZERO_LENGTH_OBJECT_ARRAY";
args += ", io.deephaven.util.type.ArrayTypeUtils.EMPTY_OBJECT_ARRAY";
}

return args;
Expand Down
7 changes: 3 additions & 4 deletions Plot/src/main/java/io/deephaven/plot/AxesImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import io.deephaven.api.ColumnName;
import io.deephaven.api.agg.Aggregation;
import io.deephaven.datastructures.util.CollectionUtil;
import io.deephaven.engine.table.impl.MemoizedOperationKey;
import io.deephaven.plot.axisformatters.AxisFormat;
import io.deephaven.plot.axisformatters.NanosAxisFormat;
Expand Down Expand Up @@ -1583,7 +1582,7 @@ public IntervalXYDataSeriesArray histPlot(final Comparable seriesName, final Sel
final List<String> allCols = new ArrayList<>(byCols);
allCols.add(x);
final SwappableTable ht = sds.getSwappableTable(seriesName, chart, tableTransform,
allCols.toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY));
allCols.toArray(String[]::new));
return histPlot(seriesName, ht);
}

Expand All @@ -1607,7 +1606,7 @@ public IntervalXYDataSeriesArray histPlot(final Comparable seriesName, final Sel
final List<String> allCols = new ArrayList<>(byCols);
allCols.add(x);
final SwappableTable ht = sds.getSwappableTable(seriesName, chart, tableTransform,
allCols.toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY));
allCols.toArray(String[]::new));
return histPlot(seriesName, ht);
}

Expand Down Expand Up @@ -1653,7 +1652,7 @@ public CategoryDataSeriesSwappablePartitionedTable catHistPlot(final Comparable
}

final Function<Table, Table> tableTransform = (Function<Table, Table> & Serializable) t -> PlotUtils
.createCategoryHistogramTable(t, cols.toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY));
.createCategoryHistogramTable(t, cols.toArray(String[]::new));
final SwappableTable counts = sds.getSwappableTable(seriesName, chart, tableTransform, categories,
CategoryDataSeries.CAT_SERIES_ORDER_COLUMN);
final CategoryDataSeriesSwappablePartitionedTable ds = new CategoryDataSeriesSwappablePartitionedTable(this,
Expand Down
3 changes: 1 addition & 2 deletions Plot/src/main/java/io/deephaven/plot/BaseFigureImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import io.deephaven.api.Selectable;
import io.deephaven.configuration.Configuration;
import io.deephaven.datastructures.util.CollectionUtil;
import io.deephaven.engine.table.PartitionedTable;
import io.deephaven.plot.errors.*;
import io.deephaven.plot.util.functions.FigureImplFunction;
Expand Down Expand Up @@ -491,7 +490,7 @@ public void consolidatePartitionedTables() {
final Map<Set<String>, PartitionedTable> byColMap = new HashMap<>();
for (final PartitionedTableHandle h : hs) {
final Set<String> keyColumns = h.getKeyColumns();
final String[] keyColumnsArray = keyColumns.toArray(CollectionUtil.ZERO_LENGTH_STRING_ARRAY);
final String[] keyColumnsArray = keyColumns.toArray(String[]::new);

final PartitionedTable partitionedTable = byColMap.computeIfAbsent(keyColumns,
x -> {
Expand Down
Loading
Loading