List of usage examples for java.util LinkedHashMap LinkedHashMap
public LinkedHashMap()
From source file:com.github.nmorel.gwtjackson.rebind.property.PropertyParser.java
public static ImmutableMap<String, PropertyAccessors> findPropertyAccessors( final RebindConfiguration configuration, TreeLogger logger, BeanInfo beanInfo) { Map<String, PropertyAccessorsBuilder> fieldsAndMethodsMap = new LinkedHashMap<String, PropertyAccessorsBuilder>(); parse(configuration, logger, beanInfo.getType(), fieldsAndMethodsMap, false); Map<String, PropertyAccessorsBuilder> propertyAccessors = new LinkedHashMap<String, PropertyAccessorsBuilder>(); for (PropertyAccessorsBuilder fieldAccessors : fieldsAndMethodsMap.values()) { propertyAccessors.put(fieldAccessors.computePropertyName(), fieldAccessors); }//w w w .j av a 2 s.com if (!beanInfo.getCreatorParameters().isEmpty()) { for (Entry<String, JParameter> entry : beanInfo.getCreatorParameters().entrySet()) { // If there is a constructor parameter referencing this property, we add it to the accessors PropertyAccessorsBuilder fieldAccessors = propertyAccessors.get(entry.getKey()); if (null == fieldAccessors) { fieldAccessors = new PropertyAccessorsBuilder(entry.getKey()); fieldAccessors.setParameter(entry.getValue()); propertyAccessors.put(fieldAccessors.computePropertyName(), fieldAccessors); } else { fieldAccessors.setParameter(entry.getValue()); } } } return ImmutableMap.copyOf(Maps.transformValues(propertyAccessors, new Function<PropertyAccessorsBuilder, PropertyAccessors>() { @Override public PropertyAccessors apply(PropertyAccessorsBuilder propertyAccessorsBuilder) { return null == propertyAccessorsBuilder ? null : propertyAccessorsBuilder.build(); } })); }
From source file:org.kitodo.data.index.elasticsearch.type.ProcessType.java
@SuppressWarnings("unchecked") @Override//from w w w .j a va 2 s .co m public HttpEntity createDocument(Process process) { LinkedHashMap<String, String> orderedProcessMap = new LinkedHashMap<>(); orderedProcessMap.put("name", process.getTitle()); orderedProcessMap.put("outputName", process.getOutputName()); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String creationDate = process.getCreationDate() != null ? dateFormat.format(process.getCreationDate()) : null; orderedProcessMap.put("creationDate", creationDate); orderedProcessMap.put("wikiField", process.getWikiField()); String project = process.getProject() != null ? process.getProject().getId().toString() : "null"; orderedProcessMap.put("project", project); String ruleset = process.getRuleset() != null ? process.getRuleset().getId().toString() : "null"; orderedProcessMap.put("ruleset", ruleset); String ldapGroup = process.getDocket() != null ? process.getDocket().getId().toString() : "null"; orderedProcessMap.put("ldapGroup", ldapGroup); JSONObject processObject = new JSONObject(orderedProcessMap); JSONArray properties = new JSONArray(); List<ProcessProperty> processProperties = process.getProperties(); for (ProcessProperty property : processProperties) { JSONObject propertyObject = new JSONObject(); propertyObject.put("title", property.getTitle()); propertyObject.put("value", property.getValue()); properties.add(propertyObject); } processObject.put("properties", properties); return new NStringEntity(processObject.toJSONString(), ContentType.APPLICATION_JSON); }
From source file:io.spring.initializr.web.mapper.DependencyMetadataV21JsonMapper.java
private static Map<String, Object> mapDependency(Dependency dep) { Map<String, Object> result = new LinkedHashMap<>(); result.put("groupId", dep.getGroupId()); result.put("artifactId", dep.getArtifactId()); if (dep.getVersion() != null) { result.put("version", dep.getVersion()); }// w ww.java 2s. c o m result.put("scope", dep.getScope()); if (dep.getBom() != null) { result.put("bom", dep.getBom()); } if (dep.getRepository() != null) { result.put("repository", dep.getRepository()); } return result; }
From source file:hr.fer.spocc.export.DotExporter.java
public static String toDotString(ParseTree parseTree, String graphName) { Validate.isTrue(!graphName.isEmpty() && StringUtils.isAlphanumeric(graphName) && Character.isLetter(graphName.charAt(0))); StringBuilder dotString = new StringBuilder(); dotString.append("digraph ").append(graphName).append(" {\n"); Map<ParseTreeNode, String> nodePrefixMap = new LinkedHashMap<ParseTreeNode, String>(); toDotNodes(parseTree.getRoot(), new StringBuilder(), nodePrefixMap, dotString); toDotEdges(parseTree.getRoot(), nodePrefixMap, dotString); dotString.append("}\n"); return dotString.toString(); }
From source file:com.egt.core.db.ddl.Tabla.java
public Tabla(String identificacion, String nombre) { this.setIdentificacion(identificacion); this.setNombre(nombre); this.setDescripcion(""); this.setSeccion(0L); this.setPropiedad(0L); this.setSincronizada(IntUtils.FALSE); this.claves = new LinkedHashMap(); this.columnas = new LinkedHashMap(); this.propiedades = new LinkedHashMap(); }
From source file:com.tussle.hitbox.HitboxComponent.java
public HitboxComponent() { hitboxes = new LinkedHashMap<>(); }
From source file:com.tussle.hitbox.HurtboxComponent.java
public HurtboxComponent() { hurtboxes = new LinkedHashMap<>(); }
From source file:com.tilab.ca.sse.core.util.SSEUtils.java
public static Map sortIntegersMap(Map passedMap) { LOG.debug("[sortHashMapIntegers] - BEGIN"); List mapKeys = new ArrayList(passedMap.keySet()); List mapValues = new ArrayList(passedMap.values()); Collections.sort(mapValues);//from w w w . java 2 s.co m Collections.reverse(mapValues); Collections.sort(mapKeys); Map sortedMap = new LinkedHashMap(); Iterator valueIt = mapValues.iterator(); while (valueIt.hasNext()) { Object val = valueIt.next(); Iterator keyIt = mapKeys.iterator(); while (keyIt.hasNext()) { Object key = keyIt.next(); String comp1 = passedMap.get(key).toString(); String comp2 = val.toString(); if (comp1.equals(comp2)) { passedMap.remove(key); mapKeys.remove(key); sortedMap.put((Integer) key, (Integer) val); break; } } } LOG.debug("[sortHashMapIntegers] - END"); return sortedMap; }
From source file:Main.java
public static <E, V extends Comparable<? super V>, K> Map<K, V> sortByValueDesc(Map<K, V> map, int limit) { List<Map.Entry<K, V>> list = new LinkedList<Map.Entry<K, V>>(map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<K, V>>() { public int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2) { return (o2.getValue()).compareTo(o1.getValue()); }/*from w w w . j av a 2 s . c o m*/ }); Map<K, V> result = new LinkedHashMap<K, V>(); int counter = 0; for (Map.Entry<K, V> entry : list) { if (limit > 0 && counter >= limit) { break; } result.put(entry.getKey(), entry.getValue()); counter++; } return result; }
From source file:javaslang.jackson.datatype.serialize.MapSerializer.java
@Override Object toJavaObj(Map<?, ?> value) throws IOException { final LinkedHashMap<Object, Object> result = new LinkedHashMap<>(); value.forEach(e -> result.put(e._1, e._2)); return result; }