io.vertx.core.MultiMap.remove()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中io.vertx.core.MultiMap.remove()方法的一些代码示例,展示了MultiMap.remove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.remove()方法的具体详情如下:
包路径:io.vertx.core.MultiMap
类名称:MultiMap
方法名:remove

MultiMap.remove介绍

[英]Like #remove(String) but accepting CharSequence as parameters
[中]

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testRemoveConvertUpperCase() {
 map.set("foo", "foo_value");
 map.remove("Foo");
 map.set("bar", "bar_value");
 map.remove((CharSequence) "Bar");
 assertHeaderNames();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testRemoveTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 CharSequence name = String.valueOf(new Object());
 MultiMap result = mmap.remove(name);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
}

代码示例来源:origin: advantageous/qbit

@Override
public boolean removeMulti(String key) {
  vertxMap.remove(key);
  return true;
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testToString() {
 MultiMap mm = newMultiMap();
 assertEquals("", mm.toString());
 mm.add("Header1", "Value1");
 assertEquals("Header1: Value1\n",
   sortByLine(mm.toString()));
 mm.add("Header2", "Value2");
 assertEquals("Header1: Value1\n"
   + "Header2: Value2\n",
   sortByLine(mm.toString()));
 mm.add("Header1", "Value3");
 assertEquals("Header1: Value1\n"
   + "Header1: Value3\n"
   + "Header2: Value2\n",
   sortByLine(mm.toString()));
 mm.remove("Header1");
 assertEquals("Header2: Value2\n",
   sortByLine(mm.toString()));
 mm.set("Header2", "Value4");
 assertEquals("Header2: Value4\n",
   sortByLine(mm.toString()));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testRemoveTest4()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "name";
 String value = "value";
 mmap.add(name, value);
 assertTrue(mmap.contains(name));
 MultiMap result = mmap.remove(name);
 assertFalse(result.contains(name));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testRemoveHashColl() {
 MultiMap mm = newMultiMap();
 String name1 = this.sameHash1;
 String name2 = this.sameHash2;
 String name3 = "RZ";
 mm.add(name1, "value1");
 mm.add(name2, "value2");
 mm.add(name3, "value3");
 mm.add(name1, "value4");
 mm.add(name2, "value5");
 mm.add(name3, "value6");
 assertEquals(3, mm.size());
 mm.remove(name1);
 mm.remove(name2);
 assertEquals(1, mm.size());
 mm = new CaseInsensitiveHeaders();
 name1 = this.sameBucket1;
 name2 = this.sameBucket2;
 mm.add(name1, "value1");
 mm.add(name2, "value2");
 assertEquals(2, mm.size());
 mm.remove(name1);
 mm.remove(name2);
 assertTrue("not empty", mm.isEmpty());
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testRemoveTest2()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "1";
 MultiMap result = mmap.remove(name);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testRemoveTest3()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "name";
 MultiMap result = mmap.remove(name);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
}

代码示例来源:origin: advantageous/qbit

@Override
public String remove(Object key) {
  vertxMap.remove(key.toString());
  return null;
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testHeadersCopiedAfterSend() throws Exception {
 MultiMap headers = new CaseInsensitiveHeaders();
 headers.add("foo", "bar");
 vertx.eventBus().consumer(ADDRESS1).handler(msg -> {
  assertNotSame(headers, msg.headers());
  assertEquals("bar", msg.headers().get("foo"));
  testComplete();
 });
 vertx.eventBus().send(ADDRESS1, "foo", new DeliveryOptions().setHeaders(headers));
 headers.remove("foo");
 await();
}

代码示例来源:origin: vert-x3/vertx-web

static MultiMap removeCookieHeaders(MultiMap headers) {
  // We don't want to remove the JSESSION cookie.
  String cookieHeader = headers.get(COOKIE);
  if (cookieHeader != null) {
   headers.remove(COOKIE);
   Set<Cookie> nettyCookies = ServerCookieDecoder.STRICT.decode(cookieHeader);
   for (Cookie cookie: nettyCookies) {
    if (cookie.name().equals("JSESSIONID")) {
     headers.add(COOKIE, ServerCookieEncoder.STRICT.encode(cookie));
     break;
    }
   }
  }
  return headers;
 }
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testRemoveConvertUpperCase() {
 map.set("foo", "foo_value");
 map.remove("Foo");
 map.set("bar", "bar_value");
 map.remove((CharSequence) "Bar");
 assertHeaderNames();
}

代码示例来源:origin: resteasy/Resteasy

private void prepareEmptyResponse()
{
 committed = true;
 response.setStatusCode(getStatus());
 transformHeaders(this, response, providerFactory);
 response.headersEndHandler(h -> {
   response.headers().remove(HttpHeaders.CONTENT_LENGTH);
   response.headers().set(HttpHeaders.CONNECTION, HttpHeaders.KEEP_ALIVE);
 });
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testRemoveTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 CharSequence name = String.valueOf(new Object());
 MultiMap result = mmap.remove(name);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testToString() {
 MultiMap mm = newMultiMap();
 assertEquals("", mm.toString());
 mm.add("Header1", "Value1");
 assertEquals("Header1: Value1\n",
   sortByLine(mm.toString()));
 mm.add("Header2", "Value2");
 assertEquals("Header1: Value1\n"
   + "Header2: Value2\n",
   sortByLine(mm.toString()));
 mm.add("Header1", "Value3");
 assertEquals("Header1: Value1\n"
   + "Header1: Value3\n"
   + "Header2: Value2\n",
   sortByLine(mm.toString()));
 mm.remove("Header1");
 assertEquals("Header2: Value2\n",
   sortByLine(mm.toString()));
 mm.set("Header2", "Value4");
 assertEquals("Header2: Value4\n",
   sortByLine(mm.toString()));
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testRemoveHashColl() {
 MultiMap mm = newMultiMap();
 String name1 = this.sameHash1;
 String name2 = this.sameHash2;
 String name3 = "RZ";
 mm.add(name1, "value1");
 mm.add(name2, "value2");
 mm.add(name3, "value3");
 mm.add(name1, "value4");
 mm.add(name2, "value5");
 mm.add(name3, "value6");
 assertEquals(3, mm.size());
 mm.remove(name1);
 mm.remove(name2);
 assertEquals(1, mm.size());
 mm = new CaseInsensitiveHeaders();
 name1 = this.sameBucket1;
 name2 = this.sameBucket2;
 mm.add(name1, "value1");
 mm.add(name2, "value2");
 assertEquals(2, mm.size());
 mm.remove(name1);
 mm.remove(name2);
 assertTrue("not empty", mm.isEmpty());
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testRemoveTest4()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "name";
 String value = "value";
 mmap.add(name, value);
 assertTrue(mmap.contains(name));
 MultiMap result = mmap.remove(name);
 assertFalse(result.contains(name));
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testRemoveTest2()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "1";
 MultiMap result = mmap.remove(name);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testRemoveTest3()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "name";
 MultiMap result = mmap.remove(name);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testHeadersCopiedAfterSend() throws Exception {
 MultiMap headers = new CaseInsensitiveHeaders();
 headers.add("foo", "bar");
 vertx.eventBus().consumer(ADDRESS1).handler(msg -> {
  assertNotSame(headers, msg.headers());
  assertEquals("bar", msg.headers().get("foo"));
  testComplete();
 });
 vertx.eventBus().send(ADDRESS1, "foo", new DeliveryOptions().setHeaders(headers));
 headers.remove("foo");
 await();
}

相关文章