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

Support Request: Creating a PersistentVector #38

Closed
smillies opened this issue Jun 26, 2020 · 1 comment
Closed

Support Request: Creating a PersistentVector #38

smillies opened this issue Jun 26, 2020 · 1 comment

Comments

@smillies
Copy link

smillies commented Jun 26, 2020

Hi there,

I was wondering what would be the most concise and efficient way to create a PersistentVector from a single element?
Is it
PersistentVector.ofIter(Collections.singletonList(elem));
or
PersistentVector.empty().append(elem)
or is there some simpler way?

I was looking for a factory method with a varargs signature, so that something like
PersistentVector.of(elem1, elem2, elem3)
becomes possible.

I apologize if opening an issue is not the right way to ask for support.
Best regards,
Sebastian

@GlenKPeterson
Copy link
Owner

GlenKPeterson commented Jun 26, 2020

import static org.organicdesign.fp.StaticImports.*;

vec(elem);

See also:
https://github.com/GlenKPeterson/Paguro/blob/master/src/test/java/org/organicdesign/fp/UsageExampleTest.java

See also the README.md

Thanks for your interest!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants