List of usage examples for com.google.common.collect Maps newLinkedHashMap
public static <K, V> LinkedHashMap<K, V> newLinkedHashMap()
From source file:com.chiorichan.factory.ScriptBinding.java
/** * Sets the value of the given variable/* w ww . j av a 2 s . c o m*/ * * @param name * the name of the variable to set * @param value * the new value for the given variable */ public void setVariable(String name, Object value) { if (variables == null) variables = Maps.newLinkedHashMap(); variables.put(name, value); history.add(name); }
From source file:net.holmes.core.business.streaming.airplay.command.AirplayCommand.java
/** * Instantiates a new Airplay command./*from ww w.j ava 2s . c o m*/ * * @param type command type * @param failureHandler failure handler */ public AirplayCommand(final CommandType type, final CommandFailureHandler failureHandler) { this.type = type; this.failureHandler = failureHandler; this.urlParameters = Maps.newHashMap(); this.postParameters = Maps.newLinkedHashMap(); }
From source file:brooklyn.util.ShellUtils.java
/** @see {@link #exec(Map, String[], String[], File, String, Logger, Object)} */ public static String[] exec(String[] cmd, String[] envp, File dir, String input, Logger log, Object context) { return exec(Maps.newLinkedHashMap(), cmd, envp, dir, input, log, context); }
From source file:cc.recommenders.mining.calls.pbn.ExportMiner.java
private static Map<Set<UsageFeature>, Integer> count(List<List<UsageFeature>> features) { Map<Set<UsageFeature>, Integer> counts = Maps.newLinkedHashMap(); for (List<UsageFeature> usage : features) { Set<UsageFeature> su = Sets.newLinkedHashSet(); su.addAll(usage);//from w w w.j a v a2s. co m int newVal; if (counts.containsKey(su)) { newVal = counts.get(su) + 1; } else { newVal = 1; } counts.put(su, newVal); } return counts; }
From source file:cc.recommenders.evaluation.evaluators.NMF1Evaluator.java
@Override public Map<NM, Boxplot> getResults() { Map<NM, Boxplot> out = Maps.newLinkedHashMap(); for (NM nm : results.keySet()) { Boxplot boxplot = results.get(nm).getBoxplot(); out.put(nm, boxplot);// www. j a v a 2s .co m } return out; }
From source file:org.ldp4j.application.kernel.session.MemberCollection.java
private MemberCollection() { this.members = Maps.newLinkedHashMap(); this.newMembers = Lists.newLinkedList(); }
From source file:org.geogit.storage.sqlite.XerialConfigDatabase.java
@Override protected Map<String, String> all(Config config) { return new DbOp<Map<String, String>>() { @Override//from w w w. ja v a 2 s . c o m protected Map<String, String> doRun(Connection cx) throws IOException, SQLException { String sql = "SELECT section,key,value FROM config"; ResultSet rs = open(open(cx.createStatement()).executeQuery(log(sql, LOG))); Map<String, String> all = Maps.newLinkedHashMap(); while (rs.next()) { String entry = String.format("%s.%s", rs.getString(1), rs.getString(2)); all.put(entry, rs.getString(3)); } return all; } }.run(connect(config)); }
From source file:org.apache.brooklyn.core.enricher.AbstractEnricher.java
public AbstractEnricher() { this(Maps.newLinkedHashMap()); }
From source file:brooklyn.entity.rebind.RebindTestUtils.java
public static <T> T serializeAndDeserialize(T memento) throws Exception { ObjectReplacer replacer = new ObjectReplacer() { private final Map<Pointer, Object> replaced = Maps.newLinkedHashMap(); @Override/*from www . j a v a 2 s . c om*/ public Object replace(Object toserialize) { if (toserialize instanceof Location || toserialize instanceof Entity) { Pointer pointer = new Pointer(((Identifiable) toserialize).getId()); replaced.put(pointer, toserialize); return pointer; } return toserialize; } @Override public Object resolve(Object todeserialize) { if (todeserialize instanceof Pointer) { return checkNotNull(replaced.get(todeserialize), todeserialize); } return todeserialize; } }; try { return Serializers.reconstitute(memento, replacer); } catch (Exception e) { try { Dumpers.logUnserializableChains(memento, replacer); //Dumpers.deepDumpSerializableness(memento); } catch (Throwable t) { LOG.warn("Error logging unserializable chains for memento " + memento + " (propagating original exception)", t); } throw e; } }
From source file:org.b1.pack.cli.FsFolderContent.java
private static Map<List<String>, File> getFileMap(List<String> names) { Map<List<String>, File> fileMap = Maps.newLinkedHashMap(); for (String name : names) { File file = new File(name); Preconditions.checkArgument(file.exists(), "File not found: %s", file); List<String> path = FileTools.getPath(file); Preconditions.checkArgument(fileMap.put(path, file) == null, "Duplicate path: %s", path); }/*from w ww . ja va 2 s.c o m*/ return fileMap; }