Skip to content

Optimize withAll on MutableIntSetFactoryImpl and ImmutableIntSetFactoryImpl #1374

@donraab

Description

@donraab

The code currently in withAll on both mutable and immutable implementations calls toArray on IntStream which if the Stream is very large can be extremely expensive and won't take advantage of a Set's ability to store only unique elements.

Current mutable factory code:

public MutableIntSet withAll(IntStream items)
{
    return this.with(items.toArray());
}

Current immutable factory code:

public ImmutableIntSet withAll(IntStream items)
{
    return this.with(items.toArray());
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions