List of usage examples for com.google.common.collect Maps newLinkedHashMap
public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(Map<? extends K, ? extends V> map)
From source file:com.medallia.tiny.ObjectProvider.java
/** make a new object provider by copying the given provider */ protected ObjectProvider(ObjectProvider from) { map = Maps.newLinkedHashMap(from.map); annotationMap = Maps.newLinkedHashMap(from.annotationMap); errorOnUnknownType = from.errorOnUnknownType; lastArg = from.lastArg;/* w w w . j a va2 s . c om*/ }
From source file:com.ardor3d.input.ControllerState.java
private void duplicateStates(final Map<String, Map<String, Float>> store) { store.clear();//from w w w .j av a 2 s . c o m for (final Entry<String, Map<String, Float>> entry : _controllerStates.entrySet()) { store.put(entry.getKey(), Maps.newLinkedHashMap(entry.getValue())); } }
From source file:org.jpmml.evaluator.BatchUtil.java
static public List<MapDifference<FieldName, ?>> difference(Batch batch, final double precision, final double zeroThreshold) throws Exception { List<? extends Map<FieldName, ?>> input = CsvUtil.load(batch.getInput()); List<? extends Map<FieldName, String>> output = CsvUtil.load(batch.getOutput()); Evaluator evaluator = PMMLUtil.createModelEvaluator(batch.getModel(), ModelEvaluatorFactory.getInstance()); List<FieldName> groupFields = evaluator.getGroupFields(); List<FieldName> targetFields = evaluator.getTargetFields(); if (groupFields.size() == 1) { FieldName groupField = groupFields.get(0); input = EvaluatorUtil.groupRows(groupField, input); } else// w w w.ja v a 2 s .com if (groupFields.size() > 1) { throw new EvaluationException(); } Equivalence<Object> equivalence = new Equivalence<Object>() { @Override public boolean doEquivalent(Object expected, Object actual) { actual = EvaluatorUtil.decode(actual); return VerificationUtil.acceptable(TypeUtil.parseOrCast(TypeUtil.getDataType(actual), expected), actual, precision, zeroThreshold); } @Override public int doHash(Object object) { return object.hashCode(); } }; if (output.size() > 0) { if (input.size() != output.size()) { throw new EvaluationException(); } List<MapDifference<FieldName, ?>> differences = Lists.newArrayList(); for (int i = 0; i < input.size(); i++) { Map<FieldName, ?> arguments = input.get(i); Map<FieldName, ?> result = evaluator.evaluate(arguments); // Delete the synthetic target field if (targetFields.size() == 0) { result = Maps.newLinkedHashMap(result); result.remove(evaluator.getTargetField()); } MapDifference<FieldName, Object> difference = Maps.<FieldName, Object>difference(output.get(i), result, equivalence); if (!difference.areEqual()) { differences.add(difference); } } return differences; } else { for (int i = 0; i < input.size(); i++) { Map<FieldName, ?> arguments = input.get(i); evaluator.evaluate(arguments); } return Collections.emptyList(); } }