mirror of
https://github.com/revanced/smali.git
synced 2025-05-04 08:34:25 +02:00
Refactor LocatedItems to use the function addItem() instead of
initItemsIfNull().
This commit is contained in:
parent
af8bc1d9cd
commit
1bf8f2544b
@ -13,12 +13,6 @@ public abstract class LocatedItems<T extends ItemWithLocation> {
|
||||
@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 abstract class LocatedItems<T extends ItemWithLocation> {
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user