Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import jetbrains.jetpad.base.function.Predicate;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -374,7 +375,7 @@ void collectReverseAncestors(HasParentT c, List<HasParentT> result) {
}

static <ItemT> List<ItemT> toList(Iterable<ItemT> it) {
List<ItemT> result = new ArrayList<>();
List<ItemT> result = new LinkedList<>();
for (ItemT i : it) {
result.add(i);
}
Expand Down Expand Up @@ -613,4 +614,4 @@ public Iterable<CompositeT> apply(CompositeT input) {

private Composites() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package jetbrains.jetpad.model.composite;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
Expand Down Expand Up @@ -53,7 +54,7 @@ public static <CompositeT extends Composite<CompositeT>> TreePath<CompositeT> de
return new TreePath<>(path);
}

private List<Integer> myPath = new ArrayList<>();
private List<Integer> myPath = new LinkedList<>();

public TreePath(CompositeT composite) {
this(composite, null);
Expand Down Expand Up @@ -114,15 +115,16 @@ public int getLastIndex() {
if (myPath.isEmpty()) {
throw new IllegalStateException();
}
return myPath.get(myPath.size() - 1);
return myPath.getLast();
}

public TreePath<CompositeT> getParent() {
if (myPath.isEmpty()) {
throw new IllegalStateException();
}

return new TreePath<>(myPath.subList(0, myPath.size() - 1));
ArrayList<Integer> treePathList = new ArrayList<>(myPath);
return new TreePath<>(treePathList.subList(0, treePathList.size() - 1));
}

public TreePath<CompositeT> getChild(int index) {
Expand Down Expand Up @@ -170,4 +172,4 @@ public int compareTo(TreePath<CompositeT> o) {
public String toString() {
return myPath.toString();
}
}
}
5 changes: 3 additions & 2 deletions util/base/src/main/java/jetbrains/jetpad/base/Asyncs.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -280,7 +281,7 @@ public void accept(Throwable failure) {

public static <ItemT> Async<List<ItemT>> composite(List<Async<ItemT>> asyncs) {
final SimpleAsync<List<ItemT>> result = new SimpleAsync<>();
final SortedMap<Integer, ItemT> succeeded = new TreeMap<>();
final HashMap<Integer, ItemT> succeeded = new HashMap<>();
final List<Throwable> exceptions = new ArrayList<>(0);
final Value<Integer> inProgress = new Value<>(asyncs.size());

Expand Down Expand Up @@ -577,4 +578,4 @@ int decrementInProgressAndGet() {
return myInProgress.decrementAndGet();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.LinkedList;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -186,7 +187,7 @@ private ThrowableHandlers() {
}

private static class MyEventSource {
private final List<Consumer<? super Throwable>> myHandlers = new ArrayList<>();
private final List<Consumer<? super Throwable>> myHandlers = new LinkedList<>();

void fire(Throwable throwable) {
for (Consumer<? super Throwable> handler : new ArrayList<>(myHandlers)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package jetbrains.jetpad.base.diff;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public final class DifferenceBuilder<ItemT> {
Expand All @@ -28,7 +29,7 @@ public DifferenceBuilder(List<ItemT> sourceList, List<ItemT> targetList) {
}

public List<DifferenceItem> build() {
List<DifferenceItem> result = new ArrayList<>();
List<DifferenceItem> result = new LinkedList<>();

List<ItemT> sourceContent = mySourceList;
List<ItemT> target = new ArrayList<>(myTargetList);
Expand Down Expand Up @@ -100,4 +101,4 @@ public String toString() {
return (isAdd ? "add" : "remove") + " " + item + "@" + index;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.google.common.collect.Range;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class DoubleRectangle {
Expand Down Expand Up @@ -137,7 +138,7 @@ public double distance(DoubleVector to) {
}

public Iterable<DoubleSegment> getParts() {
List<DoubleSegment> result = new ArrayList<>();
List<DoubleSegment> result = new LinkedList<>();
result.add(new DoubleSegment(origin, origin.add(new DoubleVector(dimension.x, 0))));
result.add(new DoubleSegment(origin, origin.add(new DoubleVector(0, dimension.y))));
result.add(new DoubleSegment(origin.add(dimension), origin.add(new DoubleVector(dimension.x, 0))));
Expand All @@ -163,4 +164,4 @@ public boolean equals(Object o) {
public String toString() {
return "[rect " + origin + ", " + dimension + "]";
}
}
}