org.rx.net.http.cookie.VolatileCookieStorage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxlib Show documentation
Show all versions of rxlib Show documentation
A set of utilities for Java
package org.rx.net.http.cookie;
import okhttp3.Cookie;
import org.rx.core.Linq;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class VolatileCookieStorage implements Iterable {
final Set store = ConcurrentHashMap.newKeySet();
public void addAll(Collection newCookies) {
store.addAll(IdentifiableCookie.decorateAll(newCookies));
}
public void clear() {
store.clear();
}
@Override
public Iterator iterator() {
return Linq.from(store).select(p -> p.cookie).iterator();
}
}