Code example for TreeSet

Methods: add, remove

0
	public synchronized void addCookie(Cookie cookie)
	{ 
		if (cookie != null)
		{ 
			// first remove any old cookie that is equivalent 
			cookies.remove(cookie);
			if (!cookie.isExpired(new Date()))
			{ 
				cookies.add(cookie);
			} 
		} 
	} 
 
	/** 
	 * Adds an array of {@link Cookie HTTP cookies}. Cookies are added 
	 * individually and 
	 * in the given array order. If any of the given cookies has already 
	 * expired it will 
	 * not be added, but existing values will still be removed. 
	 *  
	 * @param cookies