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

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

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

MultiMap.size介绍

[英]Return the number of keys.
[中]返回键的数目。

代码示例

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

@Test
public void testSize()
  throws Exception {
 MultiMap mmap = newMultiMap();
 assertEquals(0, mmap.size());
 mmap.add("header", "value");
 assertEquals(1, mmap.size());
 mmap.add("header2", "value2");
 assertEquals(2, mmap.size());
 mmap.add("header", "value3");
 assertEquals(2, mmap.size());
}

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

@Test
public void testAddIterable()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "name";
 List<String> values = new ArrayList<String>();
 values.add("value1");
 values.add("value2");
 MultiMap result = mmap.add(name, values);
 assertEquals(1, result.size());
 assertEquals("name: value1\nname: value2\n", result.toString());
}

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

@Test
public void testSetTest2()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> headers = new HashMap<String, String>();
 headers.put("", "");
 headers.put("aaa", "bbb");
 MultiMap result = mmap.setAll(headers);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(2, result.size());
 assertEquals(": \naaa: bbb\n", result.toString());
}

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

@Test
public void testSetTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> headers = new HashMap<String, String>();
 headers.put("", "");
 MultiMap result = mmap.setAll(headers);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals(": \n", result.toString());
}

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

@Test
public void testSetTest3()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> headers = new HashMap<String, String>();
 headers.put("aaa", "bbb");
 MultiMap result = mmap.setAll(headers);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals("aaa: bbb\n", result.toString());
}

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

@Test
public void testAddTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("a", "b");
 MultiMap result = mmap.addAll(map);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals("a: b\n", result.toString());
}

代码示例来源: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: eclipse-vertx/vert.x

@Test
public void testSetTest4()
  throws Exception {
 MultiMap mmap = newMultiMap();
 Map<String, String> headers = new HashMap<String, String>();
 MultiMap result = mmap.setAll(headers);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
 assertEquals("", result.toString());
}

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

@Test
public void testCaseInsensitiveHeaders()
  throws Exception {
 MultiMap result = newMultiMap();
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
 assertEquals("", result.toString());
}

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

@Test
public void testSetIterableEmpty()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "name";
 List<String> values = new ArrayList<String>();
 MultiMap result = mmap.set(name, values);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
 assertEquals("", result.toString());
}

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

@Test
public void testSetTest12()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "aaa";
 String strVal = "bbb";
 MultiMap result = mmap.set(name, strVal);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals("aaa: bbb\n", result.toString());
}

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

@Test
public void testSetTest13()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "aaa";
 String strVal = "";
 MultiMap result = mmap.set(name, strVal);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals("aaa: \n", result.toString());
}

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

@Test
public void testSetTest14()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "";
 String strVal = "bbb";
 MultiMap result = mmap.set(name, strVal);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals(": bbb\n", result.toString());
}

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

@Test
public void testAddMultiMap()
  throws Exception {
 MultiMap mmap = newMultiMap();
 MultiMap mm = newMultiMap();
 mm.add("Header1", "value1");
 mm.add("Header2", "value2");
 MultiMap result = mmap.addAll(mm);
 assertEquals(2, result.size());
 assertEquals("Header1: value1\nHeader2: value2\n", result.toString());
}

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

@Test
public void testSetTest7()
  throws Exception {
 MultiMap mmap = newMultiMap();
 CharSequence name = "name";
 CharSequence value = "value";
 MultiMap result = mmap.set(name, value);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals("name: value\n", result.toString());
}

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

@Test
public void testSetTest11()
  throws Exception {
 MultiMap mmap = newMultiMap();
 String name = "";
 String strVal = "";
 MultiMap result = mmap.set(name, strVal);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals(": \n", result.toString());
}

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

@Test
public void testClearTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 MultiMap result = mmap.clear();
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
 assertEquals("", result.toString());
}

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

@Test
public void testSetTest5()
  throws Exception {
 MultiMap mmap = newMultiMap();
 MultiMap headers = newMultiMap();
 MultiMap result = mmap.setAll(headers);
 assertNotNull(result);
 assertTrue(result.isEmpty());
 assertEquals(0, result.size());
 assertEquals("", result.toString());
}

代码示例来源: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: 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());
}

相关文章