mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
FCollection: extra get Function that checks for element in Collection
This commit is contained in:
@@ -530,6 +530,18 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
|
|||||||
return Iterables.unmodifiableIterable(new LinkedList<T>(list));
|
return Iterables.unmodifiableIterable(new LinkedList<T>(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T get(final T obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for(T x : this) {
|
||||||
|
if (x.equals(obj)) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* An unmodifiable, empty {@link FCollection}. Overrides all methods with
|
* An unmodifiable, empty {@link FCollection}. Overrides all methods with
|
||||||
* default implementations suitable for an empty collection, to improve
|
* default implementations suitable for an empty collection, to improve
|
||||||
|
|||||||
@@ -74,4 +74,6 @@ public interface FCollectionView<T> extends Iterable<T> {
|
|||||||
* {@link Iterator#remove()}), as such an operation would have no meaning.
|
* {@link Iterator#remove()}), as such an operation would have no meaning.
|
||||||
*/
|
*/
|
||||||
Iterable<T> threadSafeIterable();
|
Iterable<T> threadSafeIterable();
|
||||||
|
|
||||||
|
T get(final T obj);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user