-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
align jmh benchmark classes with benchmark suite
- Loading branch information
Showing
4 changed files
with
64 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package de.siegmar.fastcsv; | ||
|
||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* This class is used to supply rows for the JMH benchmarks. | ||
*/ | ||
public class RowSupplier implements Supplier<List<String>> { | ||
|
||
private final List<List<String>> rows; | ||
private int pos; | ||
|
||
/** | ||
* Initializes a new instance of the {@link RowSupplier} class | ||
* with the specified rows. | ||
* | ||
* @param rows the rows to supply | ||
*/ | ||
public RowSupplier(final List<List<String>> rows) { | ||
this.rows = List.copyOf(rows); | ||
pos = rows.size(); | ||
} | ||
|
||
@Override | ||
public List<String> get() { | ||
final List<String> d = rows.get(--pos); | ||
if (pos == 0) { | ||
pos = rows.size(); | ||
} | ||
return d; | ||
} | ||
|
||
} |