List of usage examples for java.util LinkedHashMap LinkedHashMap
public LinkedHashMap()
From source file:edu.northwestern.bioinformatics.studycalendar.tools.MapBasedDictionary.java
public MapBasedDictionary() { this(new LinkedHashMap<K, V>()); }
From source file:de.undercouch.bson4jackson.serializers.BsonSerializersTest.java
private static Object generateAndParse(Object data) throws Exception { Map<String, Object> m = new LinkedHashMap<String, Object>(); m.put("data", data); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectMapper om = new ObjectMapper(new BsonFactory()); om.registerModule(new BsonModule()); om.writeValue(baos, m);/*from www. ja v a 2s . co m*/ byte[] r = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(r); BSONDecoder decoder = new BasicBSONDecoder(); BSONObject bo = decoder.readObject(bais); return bo.get("data"); }
From source file:utils.HttpComm.java
public static String probe(String workerURL) throws Exception { // TODO: handle probe result Map<String, String> postArguments = new LinkedHashMap(); postArguments.put("probe", "yes"); String s = schedulerPost(workerURL, postArguments); return s;//from w w w . j a va2 s. c o m }
From source file:Main.java
/** * We could simple return new String(displayColumns + "," + valueColumn) but we want to handle the cases * where the displayColumns (valueColumn) contain more commas than needed, in the middle, start or end. * * @param valueColumn single string to appear first. * @param displayColumns comma-separated string * @return A {@link java.util.LinkedHashMap} that contains the SQL columns as keys, and the CSV columns as values *//*from w ww .ja va 2 s. com*/ public static LinkedHashMap<String, String> createMapWithDisplayingColumns(String valueColumn, String displayColumns) { valueColumn = valueColumn.trim(); LinkedHashMap<String, String> columns = new LinkedHashMap<String, String>(); columns.put(toSafeColumnName(valueColumn), valueColumn); if (displayColumns != null && displayColumns.trim().length() > 0) { displayColumns = displayColumns.trim(); List<String> commaSplitParts = splitTrimmed(displayColumns, COLUMN_SEPARATOR, FALLBACK_COLUMN_SEPARATOR); for (String commaSplitPart : commaSplitParts) { columns.put(toSafeColumnName(commaSplitPart), commaSplitPart); } } return columns; }
From source file:de.cgarbs.lib.json.type.JSONType.java
@Override public String toJSONString() { final Map<String, Object> json = new LinkedHashMap<String, Object>(); json.put(CLASS_FIELD, getJSONClassName()); json.put(VERSION_FIELD, getJSONClassVersion()); json.put(ATTRIBUTE_FIELD, getJSONAttributes()); return JSONValue.toJSONString(json); }
From source file:com.hunchee.haystack.server.JSONHelper.java
public static Map<String, Object> parseJson(String jsonText) throws ParseException { Map<String, Object> json = null; org.json.simple.parser.JSONParser parser = new org.json.simple.parser.JSONParser(); ContainerFactory containerFactory = new ContainerFactory() { public List creatArrayContainer() { return new LinkedList(); }/* w w w . j a v a2 s .co m*/ public Map createObjectContainer() { return new LinkedHashMap(); } }; json = (Map<String, Object>) parser.parse(jsonText, containerFactory); Iterator iter = json.entrySet().iterator(); LOG.info("==iterate result=="); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); LOG.info(entry.getKey() + "=>" + entry.getValue()); } LOG.info("==toJSONString()=="); LOG.info(org.json.simple.JSONValue.toJSONString(json)); return json; }
From source file:com.reachlocal.grails.plugins.cassandra.utils.DataMapper.java
public static Map<String, Object> dataProperties(GroovyObject data, List<String> transients, Map<String, Class> hasMany, String expandoMapName, Collection mappedProperties) throws IOException { Map<String, Object> map = new LinkedHashMap<String, Object>(); Class clazz = data.getClass(); if (expandoMapName != null) { transients.add(expandoMapName);//from w ww.j ava2s . co m } // Unneeded since we now get the class from the method signatures // Might be needed again if we ever support subclasses //map.put(CLASS_NAME_KEY, clazz.getName()); for (PropertyDescriptor pd : PropertyUtils.getPropertyDescriptors(data)) { String name = pd.getName(); if (!transients.contains(name) && !GLOBAL_TRANSIENTS.contains(name) && hasMany.get(name) == null) { Object prop = data.getProperty(name); if (prop == null) { if (mappedProperties.contains(name)) { map.put(name + "Id", null); } else { map.put(name, null); } } else { //if (OrmHelper.isMappedObject(prop)) { // TODO new is mapped if (mappedProperties.contains(name)) { GroovyObject g = (GroovyObject) prop; String idName = name + "Id"; map.put(idName, g.getProperty("id")); } else { Object value = dataProperty(prop); map.put(name, value); } } } } if (expandoMapName != null) { Map<String, Object> expandoMap = (Map<String, Object>) data.getProperty(expandoMapName); if (expandoMap != null) { for (Map.Entry<String, Object> entry : expandoMap.entrySet()) { map.put(entry.getKey(), entry.getValue()); } } } return map; }
From source file:com.threewks.thundr.request.servlet.ServletSupport.java
public static Map<String, List<String>> getHeaderMap(HttpServletRequest req) { Map<String, List<String>> headerMap = new LinkedHashMap<String, List<String>>(); Iterable<String> iterable = Expressive.<String>iterable(req.getHeaderNames()); for (String name : iterable) { headerMap.put(name, getHeaders(name, req)); }//from w w w . ja v a2s . co m return headerMap; }
From source file:io.servicecomb.foundation.common.net.URIEndpointObject.java
public static Map<String, List<String>> splitQuery(URI uri) { final Map<String, List<String>> queryPairs = new LinkedHashMap<String, List<String>>(); List<NameValuePair> pairs = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8.name()); for (NameValuePair pair : pairs) { List<String> list = queryPairs.computeIfAbsent(pair.getName(), name -> { return new ArrayList<>(); });// w w w. ja v a 2s.c om list.add(pair.getValue()); } return queryPairs; }
From source file:com.spotify.hamcrest.jackson.IsJsonObject.java
public static IsJsonObject jsonObject() { return new IsJsonObject(new LinkedHashMap<>()); }