Skip to content

Commit

Permalink
OAK-11191 : removed the usage of Lists.newLinkedList
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh Kumar committed Oct 16, 2024
1 parent 8e72b23 commit 33e6c14
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.Collection;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -1240,7 +1241,7 @@ private class RecordsIterator<T> extends AbstractIterator<T> {
ResultContinuation resultContinuation;
boolean firstCall = true;
final Function<AzureBlobInfo, T> transformer;
final Queue<AzureBlobInfo> items = Lists.newLinkedList();
final Queue<AzureBlobInfo> items = new LinkedList<>();

public RecordsIterator (Function<AzureBlobInfo, T> transformer) {
this.transformer = transformer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -1055,7 +1056,7 @@ class RecordsIterator<T> extends AbstractIterator<T> {
Function<S3ObjectSummary, T> transformer;

public RecordsIterator (Function<S3ObjectSummary, T> transformer) {
queue = Lists.newLinkedList();
queue = new LinkedList<>();
this.transformer = transformer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.jackrabbit.oak.plugins.observation;

import static org.apache.jackrabbit.guava.common.collect.Lists.newArrayList;
import static org.apache.jackrabbit.guava.common.collect.Lists.newLinkedList;
import static org.apache.jackrabbit.oak.api.Type.NAMES;
import static org.apache.jackrabbit.oak.api.Type.STRING;
import static org.apache.jackrabbit.oak.plugins.tree.TreeConstants.OAK_CHILD_ORDER;
Expand Down Expand Up @@ -73,7 +72,7 @@ public class EventGenerator {
*/
private static final int MAX_QUEUED_CONTINUATIONS = 1000;

private final LinkedList<Continuation> continuations = newLinkedList();
private final LinkedList<Continuation> continuations = new LinkedList<>();

/**
* Creates a new generator instance. Changes to process need to be added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import java.util.List;

import org.apache.jackrabbit.guava.common.collect.Lists;
import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;

public class GlobbingPathHelper {

Expand Down Expand Up @@ -52,7 +52,7 @@ public static String globPathAsRegex(String pathWithGlobs) {
} else if (!pathWithGlobs.contains("*")) {
return pathWithGlobs;
}
List<String> elements = Lists.newLinkedList(elements(pathWithGlobs));
List<String> elements = CollectionUtils.toLinkedList(elements(pathWithGlobs));
StringBuffer sb = new StringBuffer();
sb.append("\\Q");
if (pathWithGlobs.startsWith("/")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.jackrabbit.oak.jcr.observation;

import static org.apache.jackrabbit.guava.common.collect.Lists.newLinkedList;

import java.util.LinkedList;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -46,7 +45,7 @@ class EventQueue implements EventIterator {

private final EventGenerator generator;

private final LinkedList<Event> queue = newLinkedList();
private final LinkedList<Event> queue = new LinkedList<>();

private long position = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
package org.apache.jackrabbit.oak.segment.tool.iotrace;

import static org.apache.jackrabbit.guava.common.base.Preconditions.checkArgument;
import static org.apache.jackrabbit.guava.common.collect.Lists.newLinkedList;
import static java.lang.String.valueOf;
import static java.util.Collections.singleton;
import static org.apache.jackrabbit.oak.commons.PathUtils.elements;

import java.io.Writer;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -79,7 +79,7 @@ public BreadthFirstTrace(int depth, @NotNull String path, @NotNull Consumer<List
@Override
public void run(@NotNull NodeState node) {
updateContext(context, 0, nodeCount.incrementAndGet());
traverse(newLinkedList(singleton(getNode(node, path))), 0);
traverse(new LinkedList<>(singleton(getNode(node, path))), 0);
}

@NotNull
Expand All @@ -93,7 +93,7 @@ private static NodeState getNode(@NotNull NodeState root, @NotNull String path)

private void traverse(@NotNull Queue<NodeState> nodes, int depth) {
if (!nodes.isEmpty()) {
Queue<NodeState> children = newLinkedList();
Queue<NodeState> children = new LinkedList<>();
while (!nodes.isEmpty()) {
NodeState head = nodes.poll();
assert head != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.apache.jackrabbit.oak.spi.commit;

import static java.util.Objects.requireNonNull;
import static org.apache.jackrabbit.guava.common.collect.Lists.newLinkedList;
import static org.apache.jackrabbit.oak.spi.commit.ThreeWayConflictHandler.Resolution.IGNORED;
import static org.apache.jackrabbit.oak.spi.state.ConflictType.ADD_EXISTING_NODE;
import static org.apache.jackrabbit.oak.spi.state.ConflictType.ADD_EXISTING_PROPERTY;
Expand All @@ -35,6 +34,7 @@
import java.util.LinkedList;

import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.jetbrains.annotations.NotNull;
Expand All @@ -57,15 +57,15 @@ public class CompositeConflictHandler implements ThreeWayConflictHandler {
* @param handlers the backing handlers
*/
public CompositeConflictHandler(@NotNull Iterable<ThreeWayConflictHandler> handlers) {
this.handlers = newLinkedList(requireNonNull(handlers));
this.handlers = (LinkedList<ThreeWayConflictHandler>) CollectionUtils.toLinkedList(requireNonNull(handlers));
}

/**
* Create a new {@code CompositeConflictHandler} with no backing handlers.
* backing handler. Use {@link #addHandler(ThreeWayConflictHandler)} to add handlers.
*/
public CompositeConflictHandler() {
this.handlers = newLinkedList();
this.handlers = new LinkedList<>();
}

/**
Expand Down

0 comments on commit 33e6c14

Please sign in to comment.