Skip to content

Commit

Permalink
Simplify returned value
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Oct 11, 2024
1 parent 75b39a6 commit b543d7f
Showing 1 changed file with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import static com.fasterxml.jackson.core.JsonParser.Feature.AUTO_CLOSE_SOURCE;
Expand Down Expand Up @@ -138,32 +137,24 @@ private void close()

public static ResultRows forJsonParser(JsonParser parser, List<Column> columns)
{
return new ResultRows() {
@Override
public Iterator<List<Object>> iterator()
{
try {
return new RowWiseIterator(parser, createTypeDecoders(columns));
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
return () -> {
try {
return new RowWiseIterator(parser, createTypeDecoders(columns));
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
};
}

public static ResultRows forInputStream(InputStream stream, TypeDecoder[] decoders)
{
return new ResultRows() {
@Override
public Iterator<List<Object>> iterator()
{
try {
return new RowWiseIterator(stream, decoders);
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
return () -> {
try {
return new RowWiseIterator(stream, decoders);
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
};
}
Expand Down

0 comments on commit b543d7f

Please sign in to comment.