Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.kelvinho.tracking.mutableTracker;
- import android.support.annotation.NonNull;
- import org.kelvinho.tracking.functional.Function;
- import java.util.ArrayList;
- @SuppressWarnings({"unused", "WeakerAccess"})
- public class WArrayList<T> extends Value<ArrayList<T>> {
- public WArrayList(@NonNull final Function<ArrayList<T>> updateFunction) {
- super(updateFunction);
- }
- public WArrayList(@NonNull final ArrayList<T> value) {
- super(value);
- }
- public WArrayList() {
- super(new ArrayList<>());
- }
- public void add(@NonNull final T value) {
- super.nonNullValue().add(value);
- getGlobalGroup().change();
- }
- public void add(final int index, @NonNull final T value) {
- super.nonNullValue().add(index, value);
- }
- public void remove(final int index) {
- super.nonNullValue().remove(index);
- getGlobalGroup().change();
- }
- public int size() {
- return super.nonNullValue().size();
- }
- public T get(int index) {
- return super.nonNullValue().get(index);
- }
- public T getLastElement() {
- return get(size() - 1);
- }
- @SuppressWarnings("MethodDoesntCallSuperMethod")
- public WArrayList<T> clone() {
- return new WArrayList<>(new ArrayList<>(super.nonNullValue()));
- }
- }
Add Comment
Please, Sign In to add comment