it.unimi.dsi.fastutil.ints.IntSets Java Examples

The following examples show how to use it.unimi.dsi.fastutil.ints.IntSets. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThresholdMapFlattenerTest.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
@Test
public void test() {
	Collection<To> row1 = Arrays.asList(
		To.builder().similarity(0.5).records(new IntOpenHashSet(Arrays.asList(Integer.valueOf(1), Integer.valueOf(2)))).build(),
		To.builder().similarity(0.6).records(IntSets.singleton(3)).build());
	Collection<To> row2 = Collections.singletonList(
		To.builder().similarity(0.4).records(IntSets.singleton(1)).build());
	ThresholdMapFlattener flattener = createFlattener(3);
	ThresholdMap map = CollectingThresholdMap.builder()
		.add(1, row1)
		.add(2, row2)
		.build(flattener);
	assertThat(map.greaterOrEqual(1, 0.5)).hasSize(3);
	assertThat(map.greaterOrEqual(1, 0.5)).contains(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
	assertThat(map.greaterOrEqual(1, 0.6)).hasSize(1);
	assertThat(map.greaterOrEqual(1, 0.6)).contains(Integer.valueOf(3));
	assertThat(map.greaterOrEqual(1, 0.7)).isEmpty();
	assertThat(map.greaterOrEqual(2, 0.4)).hasSize(1);
	assertThat(map.greaterOrEqual(2, 0.4)).contains(Integer.valueOf(1));
}
 
Example #2
Source File: CollectingThresholdMapTest.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
@Test
public void test() {
	Collection<To> row1 = Arrays.asList(
		To.builder().similarity(0.5).records(new IntOpenHashSet(Arrays.asList(Integer.valueOf(1), Integer.valueOf(2)))).build(),
		To.builder().similarity(0.6).records(IntSets.singleton(3)).build());
	Collection<To> row2 = Collections.singletonList(
		To.builder().similarity(0.4).records(IntSets.singleton(1)).build());
	ThresholdMap map = CollectingThresholdMap.builder()
		.add(1, row1)
		.add(2, row2)
		.build();
	assertThat(map.greaterOrEqual(1, 0.5)).hasSize(3);
	assertThat(map.greaterOrEqual(1, 0.5)).contains(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
	assertThat(map.greaterOrEqual(1, 0.6)).hasSize(1);
	assertThat(map.greaterOrEqual(1, 0.6)).contains(Integer.valueOf(3));
	assertThat(map.greaterOrEqual(1, 0.7)).isEmpty();
	assertThat(map.greaterOrEqual(2, 0.4)).hasSize(1);
	assertThat(map.greaterOrEqual(2, 0.4)).contains(Integer.valueOf(1));
}
 
Example #3
Source File: SimilarityTableBuilderTest.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOrDefault() {
	SimilarityTableBuilder tableBuilder = createTableBuilder(3, 3);
	Collection<To> row1 = Arrays.asList(
		To.builder().similarity(0.5).right(1).records(IntSets.EMPTY_SET).build(),
		To.builder().similarity(0.6).right(2).records(IntSets.EMPTY_SET).build());
	Collection<To> row2 = Collections.singletonList(
		To.builder().similarity(0.4).right(1).records(IntSets.EMPTY_SET).build());
	tableBuilder.add(1, row1);
	tableBuilder.add(2, row2);
	Int2Int2DoubleTable table = tableBuilder.build();
	assertThat(table.getOrDefault(1, 1)).isEqualTo(0.5);
	assertThat(table.getOrDefault(1, 2)).isEqualTo(0.6);
	assertThat(table.getOrDefault(2, 1)).isEqualTo(0.4);
	assertThat(table.getOrDefault(1, 0)).isEqualTo(0.0);
	assertThat(table.getOrDefault(2, 0)).isEqualTo(0.0);
}
 
Example #4
Source File: SimilarityTableBuilderTest.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
@Test
public void testRow() {
	SimilarityTableBuilder tableBuilder = createTableBuilder(3, 3);
	Collection<To> row1 = Arrays.asList(
		To.builder().similarity(0.5).right(1).records(IntSets.EMPTY_SET).build(),
		To.builder().similarity(0.6).right(2).records(IntSets.EMPTY_SET).build());
	Collection<To> row2 = Collections.singletonList(
		To.builder().similarity(0.4).right(1).records(IntSets.EMPTY_SET).build());
	tableBuilder.add(1, row1);
	tableBuilder.add(2, row2);
	Int2Int2DoubleTable table = tableBuilder.build();
	assertThat(table.row(1).asMap()).hasSize(2);
	assertThat(table.row(1).asMap()).containsEntry(Integer.valueOf(1), Double.valueOf(0.5));
	assertThat(table.row(1).asMap()).containsEntry(Integer.valueOf(2), Double.valueOf(0.6));
	assertThat(table.row(2).asMap()).hasSize(1);
	assertThat(table.row(2).asMap()).containsEntry(Integer.valueOf(1), Double.valueOf(0.4));
}
 
Example #5
Source File: ValidatorTest.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
@Test
public void testLargerLhsEmpty() {
	MDSite lhs = new MDSiteImpl(4)
		.set(0, 0.7)
		.set(1, 0.6);
	doReturn(Integer.valueOf(0)).when(column1).getLeftValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(0)).when(column1).getLeftValue(new int[]{1, 0, 1, 0});
	doReturn(IntSets.EMPTY_SET).when(column0).getAllSimilarRightRecords(0, 0.7);
	doReturn(IntSets.EMPTY_SET).when(column0).getAllSimilarRightRecords(1, 0.7);
	when(column0.getLeftPli()).thenReturn(pli0);
	Collection<Cluster> clusters = Arrays.asList(
		new Cluster(0, IntSets.singleton(0)),
		new Cluster(1, IntSets.singleton(1)));
	when(pli0.spliterator()).thenReturn(clusters.spliterator());
	Validator validator = createValidator();
	Collection<Rhs> rhs = Collections
		.singletonList(Rhs.builder().rhsAttr(2).threshold(1.0).lowerBound(0.0).build());
	ValidationResult results = validator.validate(lhs, rhs);
	RhsResult v2 = Iterables.get(results.getRhsResults(), 0);
	assertThat(results.getLhsResult().getSupport()).isEqualTo(0L);
	assertThat(v2.getActual()).isEqualTo(new MDElementImpl(2, 1.0));
	assertThat(v2.getOriginal()).isEqualTo(new MDElementImpl(2, 1.0));
	assertThat(v2.getViolations()).isEmpty();
}
 
Example #6
Source File: ArrayPositionListIndex.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Override
public IntSet get(int valueId) {
	if (valueId >= array.length) {
		return IntSets.EMPTY_SET;
	}
	return array[valueId];
}
 
Example #7
Source File: ArrayPositionListIndex.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Override
public PositionListIndex build() {
	IntSet[] array = new IntSet[maxValue + 1];
	Arrays.fill(array, IntSets.EMPTY_SET);
	map.forEach(set(array));
	return new ArrayPositionListIndex(array);
}
 
Example #8
Source File: SimilarityIndexTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private SimilarityIndex createSimilarityIndex() {
	SimilarityComputer<Integer> similarityComputer = Mockito.mock(SimilarityComputer.class);
	SimilarityMeasure<Integer> similarityMeasure = Mockito.mock(SimilarityMeasure.class);
	Collection<Integer> leftValues = Arrays.asList(Integer.valueOf(1), Integer.valueOf(2));
	Collection<Integer> rightValues = Arrays.asList(Integer.valueOf(3), Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6));
	when(similarityComputer.compute(similarityMeasure, leftValues, rightValues))
		.thenReturn(new Result<>(Stream.of(new Similarity<>(Integer.valueOf(1), Arrays.asList(
			new To<>(Integer.valueOf(3), 1.0 / 3),
			new To<>(Integer.valueOf(4), 1.0 / 4),
			new To<>(Integer.valueOf(5), 1.0 / 4),
			new To<>(Integer.valueOf(6), 1.0 / 6)
		))), true));
	SimilarityIndexBuilder builder = createBuilder();
	when(leftDictionary.values()).thenReturn(leftValues);
	when(Integer.valueOf(leftDictionary.size())).thenReturn(Integer.valueOf(3));
	when(rightDictionary.values()).thenReturn(rightValues);
	when(Integer.valueOf(rightDictionary.size())).thenReturn(Integer.valueOf(7));
	when(Integer.valueOf(leftDictionary.getOrAdd(Integer.valueOf(1)))).thenReturn(Integer.valueOf(1));
	doReturn(new IntOpenHashSet(Arrays.asList(Integer.valueOf(13), Integer.valueOf(17)))).when(rightIndex).get(3);
	doReturn(IntSets.singleton(14)).when(rightIndex).get(4);
	doReturn(IntSets.singleton(15)).when(rightIndex).get(5);
	doReturn(IntSets.singleton(16)).when(rightIndex).get(6);
	doReturn(Integer.valueOf(3)).when(rightDictionary).getOrAdd(Integer.valueOf(3));
	doReturn(Integer.valueOf(4)).when(rightDictionary).getOrAdd(Integer.valueOf(4));
	doReturn(Integer.valueOf(5)).when(rightDictionary).getOrAdd(Integer.valueOf(5));
	doReturn(Integer.valueOf(6)).when(rightDictionary).getOrAdd(Integer.valueOf(6));
	return builder
		.create(leftDictionary, rightDictionary, similarityMeasure, similarityComputer, 0.0,
			rightIndex);
}
 
Example #9
Source File: SimilarityTableBuilderTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Test
public void testValues() {
	SimilarityTableBuilder tableBuilder = createTableBuilder(3, 3);
	Collection<To> row1 = Arrays.asList(
		To.builder().similarity(0.5).right(1).records(IntSets.EMPTY_SET).build(),
		To.builder().similarity(0.6).right(2).records(IntSets.EMPTY_SET).build());
	Collection<To> row2 = Collections.singletonList(
		To.builder().similarity(0.4).right(1).records(IntSets.EMPTY_SET).build());
	tableBuilder.add(1, row1);
	tableBuilder.add(2, row2);
	Int2Int2DoubleTable table = tableBuilder.build();
	assertThat(table.values()).hasSize(3);
	assertThat(table.values()).contains(Double.valueOf(0.4), Double.valueOf(0.5), Double.valueOf(0.6));
}
 
Example #10
Source File: ValidatorTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Test
public void test() {
	MDSite lhs = new MDSiteImpl(4)
		.set(0, 0.6);
	doReturn(new IntOpenHashSet(Arrays.asList(Integer.valueOf(0), Integer.valueOf(1)))).when(column0)
		.getAllSimilarRightRecords(0, 0.6);
	doReturn(IntSets.singleton(2)).when(column0)
		.getAllSimilarRightRecords(1, 0.6);
	doReturn(Integer.valueOf(0)).when(column2).getLeftValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(1)).when(column2).getLeftValue(new int[]{1, 0, 1, 0});
	doReturn(Integer.valueOf(0)).when(column2).getRightValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(1)).when(column2).getRightValue(new int[]{0, 0, 1, 0});
	doReturn(Integer.valueOf(2)).when(column2).getRightValue(new int[]{0, 0, 2, 0});
	doReturn(Double.valueOf(1.0)).when(column2).getSimilarity(0, 0);
	doReturn(Double.valueOf(0.1)).when(column2).getSimilarity(0, 1);
	doReturn(Double.valueOf(0.5)).when(column2).getSimilarity(1, 2);
	doReturn(new int[]{0, 0, 0, 0}).when(right).get(0);
	doReturn(new int[]{0, 0, 1, 0}).when(right).get(1);
	doReturn(new int[]{0, 0, 2, 0}).when(right).get(2);
	when(column0.getLeftPli()).thenReturn(pli0);
	Collection<Cluster> clusters = Arrays.asList(
		new Cluster(0, IntSets.singleton(0)),
		new Cluster(1, IntSets.singleton(1)));
	when(pli0.iterator()).thenReturn(clusters.iterator());
	Validator validator = createValidator();
	Collection<Rhs> rhs = Collections.singletonList(
		Rhs.builder().rhsAttr(2).threshold(1.0).lowerBound(0.0).build());
	ValidationResult results = validator.validate(lhs, rhs);
	RhsResult v2 = Iterables.get(results.getRhsResults(), 0);
	assertThat(results.getLhsResult().getLhs()).isEqualTo(lhs);
	assertThat(v2.getActual()).isEqualTo(new MDElementImpl(2, 0.1));
	assertThat(v2.getOriginal()).isEqualTo(new MDElementImpl(2, 1.0));
	assertThat(v2.getViolations()).isEmpty();
	assertThat(results.getLhsResult().getSupport()).isEqualTo(3L);
}
 
Example #11
Source File: ValidatorTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Test
public void testBelowLowerBound() {
	MDSite lhs = new MDSiteImpl(4)
		.set(0, 0.6);
	doReturn(new IntOpenHashSet(Arrays.asList(Integer.valueOf(0), Integer.valueOf(1)))).when(column0)
		.getAllSimilarRightRecords(0, 0.6);
	doReturn(IntSets.singleton(2)).when(column0)
		.getAllSimilarRightRecords(1, 0.6);
	doReturn(Integer.valueOf(0)).when(column2).getLeftValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(0)).when(column2).getRightValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(1)).when(column2).getRightValue(new int[]{0, 0, 1, 0});
	doReturn(Double.valueOf(1.0)).when(column2).getSimilarity(0, 0);
	doReturn(Double.valueOf(0.7)).when(column2).getSimilarity(0, 1);
	doReturn(new int[]{0, 0, 0, 0}).when(right).get(0);
	doReturn(new int[]{0, 0, 1, 0}).when(right).get(1);
	doReturn(new int[]{0, 0, 2, 0}).when(right).get(2);
	when(column0.getLeftPli()).thenReturn(pli0);
	Collection<Cluster> clusters = Arrays.asList(
		new Cluster(0, IntSets.singleton(0)),
		new Cluster(1, IntSets.singleton(1)));
	when(pli0.iterator()).thenReturn(clusters.iterator());
	Validator validator = createValidator();
	Collection<Rhs> rhs = Collections
		.singletonList(Rhs.builder().rhsAttr(2).threshold(1.0).lowerBound(0.7).build());
	ValidationResult results = validator.validate(lhs, rhs);
	RhsResult v2 = Iterables.get(results.getRhsResults(), 0);
	assertThat(results.getLhsResult().getLhs()).isEqualTo(lhs);
	assertThat(v2.getActual().getId()).isEqualTo(2);
	assertThat(v2.getActual().getThreshold()).isLessThanOrEqualTo(0.7);
	assertThat(v2.getOriginal()).isEqualTo(new MDElementImpl(2, 1.0));
	assertThat(v2.isValidAndMinimal()).isFalse();
	Assert.assertThat(v2.getViolations(), hasSize(greaterThanOrEqualTo(Integer.valueOf(1))));
	assertThat(v2.getViolations())
		.contains(new IntArrayPair(new int[]{0, 0, 0, 0}, new int[]{0, 0, 1, 0}));
	assertThat(results.getLhsResult().getSupport()).isEqualTo(3L);
}
 
Example #12
Source File: ValidatorTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Test
public void testBelowMinThreshold() {
	MDSite lhs = new MDSiteImpl(4)
		.set(0, 0.6);
	doReturn(new IntOpenHashSet(Arrays.asList(Integer.valueOf(0), Integer.valueOf(1)))).when(column0)
		.getAllSimilarRightRecords(0, 0.6);
	doReturn(new IntOpenHashSet(Collections.singletonList(Integer.valueOf(2)))).when(column0)
		.getAllSimilarRightRecords(1, 0.6);
	doReturn(Integer.valueOf(0)).when(column2).getLeftValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(1)).when(column2).getLeftValue(new int[]{1, 0, 1, 0});
	doReturn(Integer.valueOf(0)).when(column2).getRightValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(1)).when(column2).getRightValue(new int[]{0, 0, 1, 0});
	doReturn(Integer.valueOf(2)).when(column2).getRightValue(new int[]{0, 0, 2, 0});
	doReturn(Double.valueOf(1.0)).when(column2).getSimilarity(0, 0);
	doReturn(Double.valueOf(0.7)).when(column2).getSimilarity(0, 1);
	doReturn(Double.valueOf(0.7)).when(column2).getSimilarity(1, 2);
	doReturn(new int[]{0, 0, 0, 0}).when(right).get(0);
	doReturn(new int[]{0, 0, 1, 0}).when(right).get(1);
	doReturn(new int[]{0, 0, 2, 0}).when(right).get(2);
	when(column0.getLeftPli()).thenReturn(pli0);
	Collection<Cluster> clusters = Arrays.asList(
		new Cluster(0, IntSets.singleton(0)),
		new Cluster(1, IntSets.singleton(1)));
	when(pli0.iterator()).thenReturn(clusters.iterator());
	Validator validator = createValidator(0.8);
	Collection<Rhs> rhs = Collections
		.singletonList(Rhs.builder().rhsAttr(2).threshold(1.0).lowerBound(0.0).build());
	ValidationResult results = validator.validate(lhs, rhs);
	RhsResult v2 = Iterables.get(results.getRhsResults(), 0);
	assertThat(results.getLhsResult().getLhs()).isEqualTo(lhs);
	assertThat(v2.getActual()).isEqualTo(new MDElementImpl(2, 0.7));
	assertThat(v2.getOriginal()).isEqualTo(new MDElementImpl(2, 1.0));
	Assert.assertThat(v2.getViolations(), hasSize(greaterThanOrEqualTo(Integer.valueOf(1))));
	Assert.assertThat(v2.getViolations(),
		either(hasItem(new IntArrayPair(new int[]{0, 0, 0, 0}, new int[]{0, 0, 1, 0})))
			.or(hasItem(new IntArrayPair(new int[]{1, 0, 1, 0}, new int[]{0, 0, 2, 0}))));
	assertThat(results.getLhsResult().getSupport()).isEqualTo(3L);
}
 
Example #13
Source File: ValidatorTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Test
public void testLargerLhs() {
	MDSite lhs = new MDSiteImpl(4)
		.set(0, 0.6)
		.set(1, 0.6);
	doReturn(Integer.valueOf(0)).when(column1).getLeftValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(0)).when(column1).getLeftValue(new int[]{1, 0, 1, 0});
	doReturn(new IntOpenHashSet(Arrays.asList(Integer.valueOf(0), Integer.valueOf(1)))).when(column0)
		.getAllSimilarRightRecords(0, 0.6);
	doReturn(IntSets.singleton(2)).when(column0)
		.getAllSimilarRightRecords(1, 0.6);
	doReturn(IntSets.singleton(0)).when(column1)
		.getAllSimilarRightRecords(0, 0.6);
	doReturn(Integer.valueOf(1)).when(column2).getLeftValue(new int[]{1, 0, 1, 0});
	doReturn(Integer.valueOf(0)).when(column2).getLeftValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(0)).when(column2).getRightValue(new int[]{0, 0, 0, 0});
	doReturn(Double.valueOf(1.0)).when(column2).getSimilarity(0, 0);
	doReturn(new int[]{0, 0, 0, 0}).when(right).get(0);
	when(column0.getLeftPli()).thenReturn(pli0);
	Collection<Cluster> clusters = Arrays.asList(
		new Cluster(0, IntSets.singleton(0)),
		new Cluster(1, IntSets.singleton(1)));
	when(pli0.spliterator()).thenReturn(clusters.spliterator());
	Validator validator = createValidator();
	Collection<Rhs> rhs = Collections
		.singletonList(Rhs.builder().rhsAttr(2).threshold(1.0).lowerBound(0.0).build());
	ValidationResult results = validator.validate(lhs, rhs);
	RhsResult v2 = Iterables.get(results.getRhsResults(), 0);
	assertThat(results.getLhsResult().getSupport()).isEqualTo(1L);
	assertThat(v2.getActual()).isEqualTo(new MDElementImpl(2, 1.0));
	assertThat(v2.getOriginal()).isEqualTo(new MDElementImpl(2, 1.0));
	assertThat(v2.getViolations()).isEmpty();
}
 
Example #14
Source File: ValidatorTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Test
public void testNumberOfValidations() {
	MDSite lhs = new MDSiteImpl(4)
		.set(0, 0.6);
	doReturn(new IntOpenHashSet(Arrays.asList(Integer.valueOf(0), Integer.valueOf(1)))).when(column0)
		.getAllSimilarRightRecords(0, 0.6);
	doReturn(IntSets.singleton(2)).when(column0)
		.getAllSimilarRightRecords(1, 0.6);
	doReturn(Integer.valueOf(0)).when(column2).getLeftValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(1)).when(column2).getLeftValue(new int[]{1, 0, 1, 0});
	doReturn(Integer.valueOf(0)).when(column2).getRightValue(new int[]{0, 0, 0, 0});
	doReturn(Integer.valueOf(1)).when(column2).getRightValue(new int[]{0, 0, 1, 0});
	doReturn(Integer.valueOf(2)).when(column2).getRightValue(new int[]{0, 0, 2, 0});
	doReturn(Double.valueOf(1.0)).when(column2).getSimilarity(0, 0);
	doReturn(Double.valueOf(1.0)).when(column2).getSimilarity(0, 1);
	doReturn(Double.valueOf(1.0)).when(column2).getSimilarity(1, 2);
	doReturn(new int[]{0, 0, 0, 0}).when(right).get(0);
	doReturn(new int[]{0, 0, 1, 0}).when(right).get(1);
	doReturn(new int[]{0, 0, 2, 0}).when(right).get(2);
	when(column0.getLeftPli()).thenReturn(pli0);
	Collection<Cluster> clusters = Arrays.asList(
		new Cluster(0, IntSets.singleton(0)),
		new Cluster(1, IntSets.singleton(1)));
	when(pli0.iterator()).thenReturn(clusters.iterator());
	Validator validator = createValidator();
	Collection<Rhs> rhs = Arrays.asList(
		Rhs.builder().rhsAttr(2).threshold(1.0).lowerBound(0.0).build(),
		Rhs.builder().rhsAttr(3).threshold(1.0).lowerBound(0.0).build());
	ValidationResult results = validator.validate(lhs, rhs);
	assertThat(results.getRhsResults()).hasSize(2);
}
 
Example #15
Source File: MapPositionListIndex.java    From metanome-algorithms with Apache License 2.0 4 votes vote down vote up
@Override
public IntSet get(int valueId) {
	IntSet records = map.get(valueId);
	return Optional.ofNullable(records)
		.orElse(IntSets.EMPTY_SET);
}
 
Example #16
Source File: Object2IntHashMultimap.java    From BungeeTabListPlus with GNU General Public License v3.0 4 votes vote down vote up
public IntCollection get(T key) {
    return map.getOrDefault(key, IntSets.EMPTY_SET);
}