GlenKPeterson / Paguro

Generic, Null-safe, Immutable Collections and Functional Transformations for the JVM
Other
312 stars 24 forks source link

Support Request: Creating a PersistentVector #38

Closed smillies closed 4 years ago

smillies commented 4 years ago

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 commented 4 years ago

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!