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

Any.toValue() / Any.toValueFilter() > Add support for sequences and s… #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cordwelt
Copy link
Contributor

…treams

Comment on lines +60 to +61
is Sequence<*> -> iterator().toValueFilter()
is Stream<*> -> iterator().toValueFilter()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use a base approach for Stream and Sequence. I mean .map(toValue).forEach(valueList::add)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do this we'll have to create ListValue first. So it's just better to reuse existing function which does exactly that

}

Assertions.assertEquals(listOf(1, 2, 3, 4), message.getField("sequence")!!.listFilter.valuesList.map { it.simpleFilter.toInt() })
Assertions.assertEquals(listOf(5, 6, 7, 8), message.getField("stream")!!.listFilter.valuesList.map { it.simpleFilter.toInt() })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe is it time to implement list of primitive value util?
Something like
when (type) {
int -> message.getField("stream")!!.listFilter.valuesList.map { it.simpleFilter.toInt() }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that it's a very common use-case. But if it - let's do this

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

Successfully merging this pull request may close these issues.

3 participants