Skip to content

Commit

Permalink
OAK-11116 : Removed usage of Guava Sets.newHashSetWithExpectedSize() (#…
Browse files Browse the repository at this point in the history
…1763)

Co-authored-by: Rishabh Kumar <[email protected]>
  • Loading branch information
rishabhdaim and Rishabh Kumar authored Oct 8, 2024
1 parent f8c7b2c commit 077d38b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
package org.apache.jackrabbit.oak.segment.file.tar.index;

import static org.apache.jackrabbit.guava.common.base.Preconditions.checkElementIndex;
import static org.apache.jackrabbit.guava.common.collect.Sets.newHashSetWithExpectedSize;

import java.util.Set;
import java.util.UUID;

import org.apache.jackrabbit.oak.commons.Buffer;
import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;

class IndexV1 implements Index {

Expand All @@ -37,7 +37,7 @@ class IndexV1 implements Index {

@Override
public Set<UUID> getUUIDs() {
Set<UUID> uuids = newHashSetWithExpectedSize(entries.remaining() / IndexEntryV1.SIZE);
Set<UUID> uuids = CollectionUtils.newHashSet(entries.remaining() / IndexEntryV1.SIZE);
int position = entries.position();
while (position < entries.limit()) {
long msb = entries.getLong(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
package org.apache.jackrabbit.oak.segment.file.tar.index;

import static org.apache.jackrabbit.guava.common.base.Preconditions.checkElementIndex;
import static org.apache.jackrabbit.guava.common.collect.Sets.newHashSetWithExpectedSize;

import java.util.Set;
import java.util.UUID;

import org.apache.jackrabbit.oak.commons.Buffer;
import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;

class IndexV2 implements Index {

Expand All @@ -37,7 +37,7 @@ class IndexV2 implements Index {

@Override
public Set<UUID> getUUIDs() {
Set<UUID> uuids = newHashSetWithExpectedSize(entries.remaining() / IndexEntryV2.SIZE);
Set<UUID> uuids = CollectionUtils.newHashSet(entries.remaining() / IndexEntryV2.SIZE);
int position = entries.position();
while (position < entries.limit()) {
long msb = entries.getLong(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.apache.jackrabbit.guava.common.collect.AbstractIterator;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.guava.common.collect.PeekingIterator;
import org.apache.jackrabbit.guava.common.collect.Sets;
import org.apache.jackrabbit.guava.common.primitives.Ints;
import org.apache.jackrabbit.oak.cache.CacheValue;
import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -526,7 +526,7 @@ private static void checkUniqueClusterIds(Revision[] revisions)
if (revisions.length < 2) {
return;
}
Set<Integer> known = Sets.newHashSetWithExpectedSize(revisions.length);
Set<Integer> known = CollectionUtils.newHashSet(revisions.length);
for (Revision revision : revisions) {
if (!known.add(revision.getClusterId())) {
throw new IllegalArgumentException(
Expand Down

0 comments on commit 077d38b

Please sign in to comment.