Create primitiveStream methods for IntSet, LongSet and DoubleSet
Since 10.0, we have had primitiveStream on IntList, LongList and DoubleList. This makes the following possible:
List<String> list = IntLists.immutable.of(1, 2, 3)
.primitiveStream()
.mapToObj(Integer::toString)
.toList();
Assertions.assertEquals(List.of("1", "2", "3"), list);
There is no equivalent for IntSet, LongSet, and DoubleSet today. This will additionally require creating spliterator() for each of these.
Hi @donraab I am happy to take a look at this !
Thanks for volunteering @Novmbrain ! I have assigned the issue to you.
Hi @donraab , I am working on this issue. So far, I forked the repository, build the project locally and try to understand the mission.
Referring to the way how primitiveStream was implemented on IntList, LongList and DoubleList , I declared an abstract method in primitiveSet.stg and two default methods.
/**
* @since 12.0
*/
Spliterator.Of<name> spliterator();
/**
* @since 12.0
*/
default <name>Stream primitiveStream()
{
return StreamSupport.<type>Stream(this.spliterator(), false);
}
/**
* @since 12.0
*/
default <name>Stream primitiveParallelStream()
{
return StreamSupport.<type>Stream(this.spliterator(), true);
Afterwards, I implemented the abstract method spliterator() in
- eclipse-collections-code-generator/src/main/resources/impl/set/immutable/immutablePrimitiveEmptySet.stg
- eclipse-collections-code-generator/src/main/resources/impl/set/immutable/immutablePrimitiveSingletonSet.stg
- eclipse-collections-code-generator/src/main/resources/impl/set/mutable/primitiveHashSet.stg
- eclipse-collections-code-generator/src/main/resources/impl/set/mutable/synchronizedPrimitiveSet.stg
- eclipse-collections-code-generator/src/main/resources/impl/set/mutable/unmodifiablePrimitiveSet.stg
I guess I still need to update the files under packageeclipse-collections-code-generator/src/main/resources/impl/map,
- eclipse-collections-code-generator/src/main/resources/impl/map/abstractMutablePrimitiveKeySet.stg
- eclipse-collections-code-generator/src/main/resources/impl/map/mutable/immutablePrimitiveMapKeySet.stg
Do I misunderstand or miss something?
Thanks and looking forward to your reply :)
Hi @Novmbrain I am happy to work on this can you please give me a clue or something about the package or class I completed the setup of this project in my Local IDE