55 lines
1.6 KiB
Java
55 lines
1.6 KiB
Java
package com.franmontiel.persistentcookiejar.cache;
|
|
|
|
import f0.n;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.Set;
|
|
public class SetCookieCache implements CookieCache {
|
|
public Set<IdentifiableCookie> i = new HashSet();
|
|
|
|
public class SetCookieCacheIterator implements Iterator<n> {
|
|
public Iterator<IdentifiableCookie> i;
|
|
|
|
public SetCookieCacheIterator(SetCookieCache setCookieCache) {
|
|
this.i = setCookieCache.i.iterator();
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public boolean hasNext() {
|
|
return this.i.hasNext();
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // java.util.Iterator
|
|
public n next() {
|
|
return this.i.next().a;
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public void remove() {
|
|
this.i.remove();
|
|
}
|
|
}
|
|
|
|
@Override // com.franmontiel.persistentcookiejar.cache.CookieCache
|
|
public void addAll(Collection<n> collection) {
|
|
ArrayList arrayList = new ArrayList(collection.size());
|
|
for (n nVar : collection) {
|
|
arrayList.add(new IdentifiableCookie(nVar));
|
|
}
|
|
Iterator it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
IdentifiableCookie identifiableCookie = (IdentifiableCookie) it.next();
|
|
this.i.remove(identifiableCookie);
|
|
this.i.add(identifiableCookie);
|
|
}
|
|
}
|
|
|
|
@Override // java.lang.Iterable
|
|
public Iterator<n> iterator() {
|
|
return new SetCookieCacheIterator(this);
|
|
}
|
|
}
|