|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.keylesspalace.tusky.util; |
|
|
|
package com.keylesspalace.tusky.util; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.Nullable; |
|
|
|
import androidx.arch.core.util.Function; |
|
|
|
import androidx.arch.core.util.Function; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.AbstractList; |
|
|
|
import java.util.AbstractList; |
|
|
@ -44,6 +45,15 @@ public final class PairedList<T, V> extends AbstractList<T> { |
|
|
|
return synced.get(index); |
|
|
|
return synced.get(index); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
|
|
|
public V getPairedItemOrNull(int index) { |
|
|
|
|
|
|
|
if (index >= 0 && index < synced.size()) { |
|
|
|
|
|
|
|
return synced.get(index); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setPairedItem(int index, V element) { |
|
|
|
public void setPairedItem(int index, V element) { |
|
|
|
synced.set(index, element); |
|
|
|
synced.set(index, element); |
|
|
|
} |
|
|
|
} |
|
|
|