Skip to content

Commit

Permalink
Fixed problem with load factor in immutable sets
Browse files Browse the repository at this point in the history
  • Loading branch information
vigna committed Aug 13, 2021
1 parent c8050c0 commit 58ed44e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drv/Set.drv
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface SET KEY_GENERIC extends COLLECTION KEY_GENERIC, Set<KEY_GENERIC
/**
* Returns a type-specific spliterator on the elements of this set.
*
* <p>Set spliterators must report at least {@link Spliterator#DISTINCT}.
* <p>Set spliterators must report at least {@link Spliterator.UNIQUE}.
*
* <p>See {@link java.util.Set#spliterator()} for more documentation on the requirements
* of the returned spliterator.
Expand All @@ -74,7 +74,7 @@ public interface SET KEY_GENERIC extends COLLECTION KEY_GENERIC, Set<KEY_GENERIC
* @implSpec The default implementation returns a late-binding spliterator (see
* {@link Spliterator} for documentation on what binding policies mean)
* that wraps this instance's type specific {@link #iterator}.
* <p>Additionally, it reports {@link Spliterator#SIZED} and {@link Spliterator#DISTINCT}.
* <p>Additionally, it reports {@link Spliterator#SIZED} and {@link Spliterator#UNIQUE}.
*
* @implNote As this default implementation wraps the iterator, and {@link java.util.Iterator}
* is an inherently linear API, the returned spliterator will yield limited performance gains
Expand Down
29 changes: 29 additions & 0 deletions test/it/unimi/dsi/fastutil/longs/LongSetTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2017-2021 Sebastiano Vigna
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package it.unimi.dsi.fastutil.longs;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class LongSetTest {

@Test
public void test4() {
assertEquals(new LongOpenHashSet(new long[] { 0, 1, 2, 3, 4 }), LongSet.of(0, 1, 2, 3, 4));
}
}

0 comments on commit 58ed44e

Please sign in to comment.