![JAR search and dependency download from the Maven repository](/logo.png)
com.fillumina.performance.util.interval.IntervalBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of performance-tools Show documentation
Show all versions of performance-tools Show documentation
Configurable tool to easily compare performances of different code
snippets and to take performance telemetry of a running application.
The newest version!
package com.fillumina.performance.util.interval;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
*
* @author Francesco Illuminati
*/
public class IntervalBuilder implements Serializable {
private static final long serialVersionUID = 1L;
private final BuildableInterval iterator;
private T start, last, step;
public IntervalBuilder(final BuildableInterval iterator) {
this.iterator = iterator;
}
public IntervalBuilder to(final T last) {
this.last = last;
return this;
}
public IntervalBuilder from(final T start) {
this.start = start;
return this;
}
public IntervalBuilder step(final T step) {
this.step = step;
return this;
}
public Iterator iterator() {
iterator.setFirst(start);
iterator.setLast(last);
iterator.setStep(step);
return iterator;
}
public Iterable iterable() {
return new Iterable() {
@Override
public Iterator iterator() {
return IntervalBuilder.this.iterator();
}
};
}
public List toList() {
final List list = new ArrayList<>();
for (T t: iterable()) {
list.add(t);
}
return list;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy