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

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

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

MultiMap.iterator介绍

暂无

代码示例

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

@Test
public void testMapEntryToString() throws Exception {
 MultiMap mmap = newMultiMap();
 mmap.add("Header", "value");
 assertEquals("Header: value", mmap.iterator().next().toString());
}

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

@Test
public void testIteratorTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 Iterator<Map.Entry<String, String>> result = mmap.iterator();
 assertNotNull(result);
 assertFalse(result.hasNext());
}

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

@Test
public void testIteratorTest2()
  throws Exception {
 MultiMap mmap = newMultiMap();
 mmap.add("a", "b");
 Iterator<Map.Entry<String, String>> result = mmap.iterator();
 assertNotNull(result);
 assertTrue(result.hasNext());
}

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

@Override
public Iterator<Entry<String, Collection<String>>> iterator() {
  final Iterator<Entry<String, String>> iterator = vertxMap.iterator();
  return new Iterator<Entry<String, Collection<String>>>() {
    @Override
    public boolean hasNext() {
      return iterator.hasNext();
    }
    @Override
    public Entry<String, Collection<String>> next() {
      final Entry<String, String> next = iterator.next();
      return new Entry<String, Collection<String>>() {
        @Override
        public String getKey() {
          return next.getKey();
        }
        @Override
        public Collection<String> getValue() {
          return (Collection<String>) MultiMapWrapper.this.getAll(next.getKey());
        }
        @Override
        public Collection<String> setValue(Collection<String> value) {
          return null;
        }
      };
    }
  };
}

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

@Test
public void testMapEntryToString() throws Exception {
 MultiMap mmap = newMultiMap();
 mmap.add("Header", "value");
 assertEquals("Header: value", mmap.iterator().next().toString());
}

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

@Test
public void testIteratorTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 Iterator<Map.Entry<String, String>> result = mmap.iterator();
 assertNotNull(result);
 assertFalse(result.hasNext());
}

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

@Test
public void testIteratorTest2()
  throws Exception {
 MultiMap mmap = newMultiMap();
 mmap.add("a", "b");
 Iterator<Map.Entry<String, String>> result = mmap.iterator();
 assertNotNull(result);
 assertTrue(result.hasNext());
}

代码示例来源:origin: eclipse/hono

@Override
public Iterator<Entry<String, String>> iterator() {
  return multiMap.iterator();
}

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

@Override
public Iterator<Entry<String, Collection<String>>> iterator() {
  final Iterator<Entry<String, String>> iterator = vertxMap.iterator();
  return new Iterator<Entry<String, Collection<String>>>() {
    @Override
    public boolean hasNext() {
      return iterator.hasNext();
    }
    @Override
    public Entry<String, Collection<String>> next() {
      final Entry<String, String> next = iterator.next();
      return new Entry<String, Collection<String>>() {
        @Override
        public String getKey() {
          return next.getKey();
        }
        @Override
        public Collection<String> getValue() {
          return (Collection<String>) MultiMapWrapper.this.getAll(next.getKey());
        }
        @Override
        public Collection<String> setValue(Collection<String> value) {
          return null;
        }
      };
    }
  };
}

代码示例来源:origin: org.apache.bookkeeper.http/vertx-http-server

/**
 * Convert http request parameters to a map.
 */
@SuppressWarnings("unchecked")
Map<String, String> convertParams(HttpServerRequest request) {
  Map<String, String> map = new HashMap<>();
  Iterator<Map.Entry<String, String>> iterator = request.params().iterator();
  while (iterator.hasNext()) {
    Map.Entry<String, String> entry = iterator.next();
    map.put(entry.getKey(), entry.getValue());
  }
  return map;
}

代码示例来源:origin: de.braintags/NetRelayController

/**
 * @param startKey
 * @param map
 * @param attrs
 */
private void extractPropertiesFromMap(String startKey, Map<String, String> map, MultiMap attrs) {
 Iterator<Entry<String, String>> it = attrs.iterator();
 while (it.hasNext()) {
  Entry<String, String> entry = it.next();
  String key = entry.getKey().toLowerCase();
  if (key.startsWith(startKey)) {
   String pureKey = key.substring(startKey.length());
   String value = entry.getValue();
   map.put(pureKey, value);
  }
 }
}

代码示例来源:origin: dmart28/gcplot

@Override
public Map<String, List<String>> headers() {
  Map<String, List<String>> result = new HashMap<>();
  context.request().headers().iterator().forEachRemaining(e ->
      result.computeIfAbsent(e.getKey(), k -> new LinkedList<>()).add(e.getValue()));
  return result;
}

代码示例来源:origin: io.knotx/knotx-databridge-adapter-http

public static String encodeBody(final MultiMap formAttributes, Charset charset) {
 if (formAttributes == null || formAttributes.isEmpty()) {
  return StringUtils.EMPTY;
 } else {
  Iterator<Entry<String, String>> entryIt = formAttributes
    .getDelegate()
    .iterator();
  StringBuilder sb = new StringBuilder(128);
  while (entryIt.hasNext()) {
   Entry<String, String> entry = entryIt.next();
   sb.append(encodeComponent(entry.getKey(), charset));
   if (entry.getValue() != null) {
    sb.append('=');
    sb.append(encodeComponent(entry.getValue(), charset));
   }
   if (entryIt.hasNext()) {
    sb.append('&');
   }
  }
  return sb.toString();
 }
}

代码示例来源:origin: de.braintags/NetRelayController

void extract(RoutingContext context, int position) {
 searchValue = context.request().getParam("sSearch_" + position);
 Iterator<Map.Entry<String, String>> it = context.request().params().iterator();
 while (it.hasNext()) {
  Map.Entry<String, String> entry = it.next();
  if (entry.getKey().startsWith("iSortCol_") && entry.getValue().equals(String.valueOf(position))) {
   this.sortable = true;
   String dirProp = "sSortDir_" + entry.getKey().substring("iSortCol_".length());
   String dir = context.request().getParam(dirProp);
   if (dir != null && "desc".equals(dir)) {
    this.asc = false;
   }
   break;
  }
 }
}

代码示例来源:origin: Cognifide/knotx

public static String encodeBody(final MultiMap formAttributes, Charset charset) {
 if (formAttributes == null || formAttributes.isEmpty()) {
  return StringUtils.EMPTY;
 } else {
  Iterator<Entry<String, String>> entryIt = formAttributes
    .getDelegate()
    .iterator();
  StringBuilder sb = new StringBuilder(128);
  while (entryIt.hasNext()) {
   Entry<String, String> entry = entryIt.next();
   sb.append(encodeComponent(entry.getKey(), charset));
   if (entry.getValue() != null) {
    sb.append('=');
    sb.append(encodeComponent(entry.getValue(), charset));
   }
   if (entryIt.hasNext()) {
    sb.append('&');
   }
  }
  return sb.toString();
 }
}

代码示例来源:origin: org.zalando/vertx-swagger

handler.handle(Future.failedFuture(ise));
} catch (Exception e) {
  String paramName = routingContext.request().params().iterator().next().getKey();
  handleParseError(paramName, e, routingContext);
  handler.handle(Future.failedFuture(e));

相关文章