From 400f0ce5a29d5d8e65ef8bb918026c1461a5111a Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Sun, 8 Sep 2013 23:02:24 +0200 Subject: [PATCH] Made remove() methods return the removed value. --- .../java/org/eclipse/jetty/http/HttpFields.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java index c6b6762aa07..c8f3b4f23e8 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java @@ -18,10 +18,6 @@ package org.eclipse.jetty.http; -import static org.eclipse.jetty.util.QuotedStringTokenizer.isQuoted; -import static org.eclipse.jetty.util.QuotedStringTokenizer.quoteOnly; - -import java.io.IOException; import java.nio.ByteBuffer; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -47,12 +43,13 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.DateCache; import org.eclipse.jetty.util.LazyList; import org.eclipse.jetty.util.QuotedStringTokenizer; -import org.eclipse.jetty.util.StringMap; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.Trie; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import static org.eclipse.jetty.util.QuotedStringTokenizer.isQuoted; + /** * HTTP Fields. A collection of HTTP header and or Trailer fields. @@ -649,14 +646,15 @@ public class HttpFields implements Iterable * * @param name the field to remove */ - public void remove(HttpHeader name) + public HttpField remove(HttpHeader name) { for (int i=_fields.size();i-->0;) { HttpField f=_fields.get(i); if (f.getHeader()==name) - _fields.remove(i); + return _fields.remove(i); } + return null; } /** @@ -664,14 +662,15 @@ public class HttpFields implements Iterable * * @param name the field to remove */ - public void remove(String name) + public HttpField remove(String name) { for (int i=_fields.size();i-->0;) { HttpField f=_fields.get(i); if (f.getName().equalsIgnoreCase(name)) - _fields.remove(i); + return _fields.remove(i); } + return null; } /**