Permalink
Browse files

Refactor LocatedItems to use the function addItem() instead of

initItemsIfNull().
  • Loading branch information...
A4Vision authored and JesusFreke committed Jul 17, 2018
1 parent af8bc1d commit 1bf8f2544b04c86d10f684e0a6098953d1e4be00
Showing with 8 additions and 8 deletions.
  1. +8 −8 dexlib2/src/main/java/org/jf/dexlib2/builder/LocatedItems.java
@@ -13,12 +13,6 @@
@Nullable
private List<T> items = null;
private void initItemsIfNull() {
if (items == null) {
items = new ArrayList<>(1);
}
}
@Nonnull
private List<T> getItems() {
if (items == null) {
@@ -70,13 +64,19 @@ public boolean add(@Nonnull T item) {
throw new IllegalArgumentException(getAddLocatedItemError());
}
item.setLocation(newItemsLocation);
initItemsIfNull();
items.add(item);
addItem(item);
return true;
}
};
}
private void addItem(@Nonnull T item) {
if (items == null) {
items = new ArrayList<>(1);
}
items.add(item);
}
protected abstract String getAddLocatedItemError();
public void mergeItemsIntoNext(@Nonnull MethodLocation nextLocation, LocatedItems<T> otherLocatedItems) {

0 comments on commit 1bf8f25

Please sign in to comment.