what-the-bank/sources/org/bouncycastle/util/CollectionStore.java

34 lines
921 B
Java

package org.bouncycastle.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
/* loaded from: classes6.dex */
public class CollectionStore<T> implements Store<T>, Iterable<T> {
private Collection<T> _local;
@Override // org.bouncycastle.util.Iterable, java.lang.Iterable
public Iterator<T> iterator() {
return getMatches(null).iterator();
}
@Override // org.bouncycastle.util.Store
public Collection<T> getMatches(Selector<T> selector) {
if (selector == null) {
return new ArrayList(this._local);
}
ArrayList arrayList = new ArrayList();
for (T t : this._local) {
if (selector.match(t)) {
arrayList.add(t);
}
}
return arrayList;
}
public CollectionStore(Collection<T> collection) {
this._local = new ArrayList(collection);
}
}