mirror of
https://github.com/revanced/smali.git
synced 2025-05-04 00:24:34 +02:00
Change ImmutableList.convert to return an empty list rather than null
This commit is contained in:
parent
a8d9abfc24
commit
22eede870f
@ -33,6 +33,7 @@ package org.jf.util;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -48,14 +49,15 @@ public abstract class ImmutableListConverter<ImmutableItem, Item> {
|
|||||||
* Converts a {@code List} of {@code Item}s to an {@code ImmutableList} of {@code ImmutableItem}s.
|
* Converts a {@code List} of {@code Item}s to an {@code ImmutableList} of {@code ImmutableItem}s.
|
||||||
*
|
*
|
||||||
* If the provided list is already an ImmutableList of ImmutableItems, then the list is not copied and is returned
|
* If the provided list is already an ImmutableList of ImmutableItems, then the list is not copied and is returned
|
||||||
* as-is
|
* as-is. If the list is null, an empty ImmutableList will be returned
|
||||||
*
|
*
|
||||||
* @param list The list of items to convert
|
* @param list The list of items to convert.
|
||||||
* @return An ImmutableList of ImmutableItem
|
* @return An ImmutableList of ImmutableItem. If list is null, an empty list will be returned.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
public ImmutableList<ImmutableItem> convert(@Nullable final List<? extends Item> list) {
|
public ImmutableList<ImmutableItem> convert(@Nullable final List<? extends Item> list) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return null;
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean needsCopy = false;
|
boolean needsCopy = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user