Unused imports
This commit is contained in:
@@ -19,8 +19,6 @@
|
|||||||
package com.samskivert.util;
|
package com.samskivert.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@@ -208,22 +206,22 @@ public abstract class ObserverList<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean add (int index, T element) {
|
@Override public boolean add (int index, T element) {
|
||||||
if (element == null) throw new NullPointerException("Null observers not allowed.");
|
if (element == null) { throw new NullPointerException("Null observers not allowed."); }
|
||||||
if (isDuplicate(element)) return false;
|
if (isDuplicate(element)) { return false; }
|
||||||
_list.add(index, element);
|
_list.add(index, element);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean add (T element) {
|
@Override public boolean add (T element) {
|
||||||
if (element == null) throw new NullPointerException("Null observers not allowed.");
|
if (element == null) { throw new NullPointerException("Null observers not allowed."); }
|
||||||
if (isDuplicate(element)) return false;
|
if (isDuplicate(element)) { return false; }
|
||||||
_list.add(element);
|
_list.add(element);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean remove (T element) {
|
@Override public boolean remove (T element) {
|
||||||
int idx = indexOf(element);
|
int idx = indexOf(element);
|
||||||
if (idx < 0) return false;
|
if (idx < 0) { return false; }
|
||||||
_list.remove(idx);
|
_list.remove(idx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -267,7 +265,7 @@ public abstract class ObserverList<T>
|
|||||||
/** Used to determine whether an element is in the list. */
|
/** Used to determine whether an element is in the list. */
|
||||||
protected int indexOf (T element) {
|
protected int indexOf (T element) {
|
||||||
for (int ii = 0, ll = _list.size(); ii < ll; ii++) {
|
for (int ii = 0, ll = _list.size(); ii < ll; ii++) {
|
||||||
if (_list.get(ii) == element) return ii;
|
if (_list.get(ii) == element) { return ii; }
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ package com.samskivert.util;
|
|||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
import java.util.AbstractList;
|
|
||||||
|
|
||||||
import com.samskivert.util.ObserverList.ObserverOp;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An {@link ObserverList} equivalent that does not prevent added observers from being
|
* An {@link ObserverList} equivalent that does not prevent added observers from being
|
||||||
* garbage-collected.
|
* garbage-collected.
|
||||||
@@ -135,7 +131,7 @@ public class WeakObserverList<T> extends ObserverList<T>
|
|||||||
@Override protected int indexOf (WeakReference<T> ref) {
|
@Override protected int indexOf (WeakReference<T> ref) {
|
||||||
T value = ref.get();
|
T value = ref.get();
|
||||||
for (int ii = 0, ll = _list.size(); ii < ll; ii++) {
|
for (int ii = 0, ll = _list.size(); ii < ll; ii++) {
|
||||||
if (_list.get(ii).get() == value) return ii;
|
if (_list.get(ii).get() == value) { return ii; }
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user