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

Range generator #130

Closed
dmfs opened this issue Dec 12, 2017 · 2 comments
Closed

Range generator #130

dmfs opened this issue Dec 12, 2017 · 2 comments

Comments

@dmfs
Copy link
Owner

dmfs commented Dec 12, 2017

In order to iterate ranges of values, I want a Range generator.

We can consider to make it very generic by accepting a Function which returns the next value and a Comparator to determine when the end is reached (or only support Comparables). Not sure if that would be too much though.

@dmfs
Copy link
Owner Author

dmfs commented Dec 12, 2017

The basic idea would be this:

public final class Range<T extends Comparable<T>> implements Iterable<T>
{
    public Range(T start, T end, Function<T, T> stepFunction)
    {
       …
    }
}

This should work for Integer and Long but also for Float and String

@dmfs
Copy link
Owner Author

dmfs commented Dec 13, 2017

duplicate of #88

@dmfs dmfs closed this as completed Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant