org.eclipse.jetty.util.MultiMap.put()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(107)

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

MultiMap.put介绍

[英]Put and entry into the map.
[中]把它放到地图上。

代码示例

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * Shorthand version of putAll
 * @param input the input map
 */
public void putAllValues(Map<String, V> input)
{
  for(Map.Entry<String,V> entry: input.entrySet())
  {
    put(entry.getKey(), entry.getValue());
  }
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/** 
 * Put multi valued entry.
 * @param name The entry key. 
 * @param value The simple value
 * @return The previous value or null.
 */
public List<V> put(String name, V value) 
{
  if(value == null) {
    return super.put(name, null);
  }
  List<V> vals = new ArrayList<>();
  vals.add(value);
  return put(name,vals);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/** Add values to multi valued entry.
 * If the entry is single valued, it is converted to the first
 * value of a multi valued entry.
 * @param name The entry key. 
 * @param values The String array of multiple values.
 */
public void addValues(String name, V[] values) 
{
  List<V> lo = get(name);
  if(lo == null) {
    lo = new ArrayList<>();
  }
  lo.addAll(Arrays.asList(values));
  put(name,lo);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/** Add values to multi valued entry.
 * If the entry is single valued, it is converted to the first
 * value of a multi valued entry.
 * @param name The entry key. 
 * @param values The List of multiple values.
 */
public void addValues(String name, List<V> values) 
{
  List<V> lo = get(name);
  if(lo == null) {
    lo = new ArrayList<>();
  }
  lo.addAll(values);
  put(name,lo);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/** Remove value.
 * @param name The entry key. 
 * @param value The entry value. 
 * @return true if it was removed.
 */
public boolean removeValue(String name,V value)
{
  List<V> lo = get(name);
  if((lo == null)||(lo.isEmpty())) {
    return false;
  }
  boolean ret = lo.remove(value);
  if(lo.isEmpty()) {
    remove(name);
  } else {
    put(name,lo);
  }
  return ret;
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

headers.put(key, value);
if (key.equalsIgnoreCase("content-disposition"))
  contentDisposition=value;

代码示例来源:origin: stackoverflow.com

// create multimap to store key and values
MultiMap multiMap = new MultiValueMap();
// put values into map for segment
multiMap.put("segment", "1");
multiMap.put("segment", "100");
// put values into map for subDepartment
multiMap.put("subDepartment", "2");
multiMap.put("subDepartment", "200");
// put values into map for officerTitle
multiMap.put("officerTitle", "3");
multiMap.put("officerTitle", "300");

代码示例来源:origin: stackoverflow.com

MultiMap timeWindows = new MultiValueMap();
   timeWindows.put("open", "123");
   timeWindows.put("close", "124");
   timeWindows.put("open", "523");
   timeWindows.put("close", "524");
   timeWindows.put("open", "823");
   timeWindows.put("close", "824");
   System.out.println("timeWindows : "+timeWindows);

代码示例来源:origin: stackoverflow.com

MultiMap mapValue = new MultiValueMap();
 mapValue.put("1", "xyz");
 mapValue.put("1", "abc");
 mapValue.put("1", "cde");
 mapValue.put("2", "err");
 System.out.println("Map : " + mapValue);

代码示例来源:origin: stackoverflow.com

MultiMap multiMap = new MultiValueMap();
   multiMap.put("key", 12334);
   multiMap.put("key", 31231);
   multiMap.put("key", 12312);
   multiMap.put("key", 12312);
   System.out.println(multiMap);

代码示例来源:origin: stackoverflow.com

// create multimap to store key and values
MultiMap multiMap = new MultiValueMap();

// put multiple values for "key" 
multiMap.put("key", "Apple");
multiMap.put("key", "Aeroplane");
multiMap.put("key", "Hello World");

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Shorthand version of putAll
 * @param input the input map
 */
public void putAllValues(Map<String, V> input)
{
  for(Map.Entry<String,V> entry: input.entrySet())
  {
    put(entry.getKey(), entry.getValue());
  }
}

代码示例来源:origin: stackoverflow.com

MultiMap dict = new MultiHashMap();
dict.put("a", "apple");
dict.put("a", "ajar");
.
.
.
dict.put("u", "umbrella");
dict.put("y", "yolk");

代码示例来源:origin: Nextdoor/bender

/**
 * Shorthand version of putAll
 * @param input the input map
 */
public void putAllValues(Map<String, V> input)
{
  for(Map.Entry<String,V> entry: input.entrySet())
  {
    put(entry.getKey(), entry.getValue());
  }
}

代码示例来源:origin: jenkinsci/winstone

/**
 * Shorthand version of putAll
 * @param input the input map
 */
public void putAllValues(Map<String, V> input)
{
  for(Map.Entry<String,V> entry: input.entrySet())
  {
    put(entry.getKey(), entry.getValue());
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Shorthand version of putAll
 * @param input the input map
 */
public void putAllValues(Map<String, V> input)
{
  for(Map.Entry<String,V> entry: input.entrySet())
  {
    put(entry.getKey(), entry.getValue());
  }
}

代码示例来源:origin: jenkinsci/winstone

@Override
public void parsedField(String key, String value)
{
  // Add to headers and mark if one of these fields. //
  headers.put(StringUtil.asciiToLowerCase(key), value);
  if (key.equalsIgnoreCase("content-disposition"))
    contentDisposition = value;
  else if (key.equalsIgnoreCase("content-type"))
    contentType = value;
  
  // Transfer encoding is not longer considers as it is deprecated as per
  // https://tools.ietf.org/html/rfc7578#section-4.7
  
}

代码示例来源:origin: org.eclipse.jetty/jetty-http

@Override
public void parsedField(String key, String value)
{
  // Add to headers and mark if one of these fields. //
  headers.put(StringUtil.asciiToLowerCase(key), value);
  if (key.equalsIgnoreCase("content-disposition"))
    contentDisposition = value;
  else if (key.equalsIgnoreCase("content-type"))
    contentType = value;
  
  // Transfer encoding is not longer considers as it is deprecated as per
  // https://tools.ietf.org/html/rfc7578#section-4.7
  
}

代码示例来源:origin: stackoverflow.com

MultiMap stateCityMap= new MultiHashMap();
String state;
String city;
while ((line=br.readLine())!=null){
  state=line.split("-")[0];
  city=line.split("-")[1];
  stateCityMap.put(state, city);
}

代码示例来源:origin: stackoverflow.com

MultiMap mhm = new MultiHashMap();
for ( string line: array) {
  String []pair = line.split(" ");
  mhm.put(pair[0],pair[1]);
}

for (Collection coll = (Collection) mhm.values() ) {
 //print all values from collection?
}

相关文章