Skip to content

Remove unnecessary immutable stuff #738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 0 additions & 205 deletions database/src/main/java/com/firebase/ui/database/ImmutableList.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;

import java.util.Collection;
import java.util.Iterator;
import java.util.AbstractList;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.CopyOnWriteArrayList;

/**
Expand All @@ -19,7 +16,7 @@
*
* @param <E> a POJO class to which the DataSnapshots can be converted.
*/
public abstract class ObservableSnapshotArray<E> extends ImmutableList<DataSnapshot> {
public abstract class ObservableSnapshotArray<E> extends AbstractList<DataSnapshot> {
protected final List<ChangeEventListener> mListeners = new CopyOnWriteArrayList<>();
protected final SnapshotParser<E> mParser;

Expand Down Expand Up @@ -133,70 +130,13 @@ public E getObject(int index) {
return mParser.parseSnapshot(get(index));
}

@Override
public int size() {
return getSnapshots().size();
}

@Override
public boolean isEmpty() {
return getSnapshots().isEmpty();
}

@Override
public boolean contains(Object o) {
return getSnapshots().contains(o);
}

@Override
public Iterator<DataSnapshot> iterator() {
return new ImmutableIterator(getSnapshots().iterator());
}

@Override
public DataSnapshot[] toArray() {
return getSnapshots().toArray(new DataSnapshot[getSnapshots().size()]);
}

@Override
public boolean containsAll(Collection<?> c) {
return getSnapshots().containsAll(c);
}

@Override
public DataSnapshot get(int index) {
return getSnapshots().get(index);
}

@Override
public int indexOf(Object o) {
return getSnapshots().indexOf(o);
}

@Override
public int lastIndexOf(Object o) {
return getSnapshots().lastIndexOf(o);
}

@Override
public ListIterator<DataSnapshot> listIterator() {
return new ImmutableListIterator(getSnapshots().listIterator());
}

@Override
public ListIterator<DataSnapshot> listIterator(int index) {
return new ImmutableListIterator(getSnapshots().listIterator(index));
}

/**
* Guaranteed to throw an exception. Use {@link #toArray()} instead to get an array of {@link
* DataSnapshot}s.
*
* @throws UnsupportedOperationException always
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Override
public final <T> T[] toArray(T[] a) {
throw new UnsupportedOperationException();
public int size() {
return getSnapshots().size();
}
}