OAK-11024 : removed usage of Sets.newHashSet#1678
Conversation
2fda374 to
61319de
Compare
reschke
left a comment
There was a problem hiding this comment.
some comments; will do full review later on
|
|
||
| // membership-nesting is 1 => expect only 'USER_ID' plus the declared group-membership | ||
| Set<String> expected = Sets.newHashSet(USER_ID); | ||
| Set<String> expected = new HashSet<>(); |
There was a problem hiding this comment.
maybe:
Set expected = Stream.of(USER_ID).collect(Collectors.toSet());
?
|
|
||
| Set<String> retrieved = newHashSet(Iterables.transform(newHashSet(dataStore.getAllRecords()), | ||
| input -> input.getIdentifier().toString())); | ||
| Set<DataRecord> recordSet = new HashSet<>(); |
There was a problem hiding this comment.
Maybe
CollectionUtils.toSet(...)
?
|
|
||
| Set<String> retrieved = newHashSet(Iterables.transform(newHashSet(dataStore.getAllRecords()), | ||
| input -> input.getIdentifier().toString())); | ||
| Set<DataRecord> recordSet = new HashSet<>(); |
| } | ||
|
|
||
| Set<DataRecord> retrieved = newHashSet((dataStore.getAllRecords())); | ||
| Set<DataRecord> retrieved = new HashSet<>(); |
30a5630 to
3db5fe3
Compare
|
@reschke @mbaedke Updated this PR with utils from oak-commons. Could you please review and share feedback? |
reschke
left a comment
There was a problem hiding this comment.
Thanks a lot :-)
- I believe you missed a few cases where you touched StreamSupport (maybe just because of removing static imports) where we could now use CollectionUtils
- furthermore it would be good to converge on a strategy whether Collectors.something should be a static import (right now it seems to me mixed)
| // that's not stored along with the other mappings | ||
| Set<String> prefixes = newHashSet(""); | ||
| Set<String> uris = newHashSet(""); | ||
| Set<String> prefixes = new HashSet<>(); |
| import org.jetbrains.annotations.NotNull; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
|
|
| private boolean waitForRunningIndexCycles() { | ||
| Map<IndexStatsMBean, Long> origIndexLaneToExecutinoCountMap = Maps.asMap( | ||
| Sets.newHashSet(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false) | ||
| new HashSet<>(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false) |
There was a problem hiding this comment.
I don't think this would give us any additional benefit.
|
|
||
| private List<String> getReindexIndexPaths() { | ||
| return stream(store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME).getChildNodeEntries().spliterator(), false) | ||
| return StreamSupport.stream(store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME).getChildNodeEntries().spliterator(), false) |
There was a problem hiding this comment.
It is returning List not Set
| val.append(" = {").append(v).append("}"); | ||
| } else if (ps.getType() == BINARIES) { | ||
| String v = stream(ps.getValue(BINARIES).spliterator(), false) | ||
| String v = StreamSupport.stream(ps.getValue(BINARIES).spliterator(), false) |
| import java.util.stream.Collectors; | ||
|
|
||
| import static java.util.stream.Collectors.toSet; | ||
|
|
There was a problem hiding this comment.
We should agree on a consistent strategy whether the Collector imports should be static (I'm leaning towards "no")..
| */ | ||
| public Iterable<NodeDocument> getPossiblyDeletedDocs(final long fromModified, final long toModified) { | ||
| return stream(getSelectedDocuments(store, NodeDocument.DELETED_ONCE, 1).spliterator(), false) | ||
| return StreamSupport.stream(getSelectedDocuments(store, NodeDocument.DELETED_ONCE, 1).spliterator(), false) |
| @NotNull final Set<String> excludePaths) { | ||
| // (_modified = fromModified && _id > fromId || _modified > fromModified && _modified < toModified) | ||
| final Stream<NodeDocument> s1 = stream(getSelectedDocuments(store, | ||
| final Stream<NodeDocument> s1 = StreamSupport.stream(getSelectedDocuments(store, |
|
thanks for the review @reschke. I only changed where we are using Guava's Let's open separate Jiras for other changes instead of piggybacking this one. For now, I will merge this PR. |
fd911f3 to
041e4ca
Compare
|
Works for me; at some point we need final cleanup sweep anyway. |
No description provided.