@JsonCreator public PlanNodeStatsEstimate( @JsonProperty("outputRowCount") double outputRowCount, @JsonProperty("symbolStatistics") Map<Symbol, SymbolStatsEstimate> symbolStatistics) { this(outputRowCount, HashTreePMap.from(requireNonNull(symbolStatistics, "symbolStatistics is null"))); }
public PMap<K, V> build() { return HashTreePMap.from(build); } }
public static <K, V> PMap<K, V> of() { return HashTreePMap.from(new HashMap<>()); } public static <K, V> PMap<K, V> of(K key, V value) {
@JsonCreator public PlanNodeStatsEstimate( @JsonProperty("outputRowCount") double outputRowCount, @JsonProperty("symbolStatistics") Map<Symbol, SymbolStatsEstimate> symbolStatistics) { this(outputRowCount, HashTreePMap.from(requireNonNull(symbolStatistics, "symbolStatistics is null"))); }
UtilityTest.assertEqualsAndHash(map.entrySet(), pmap.entrySet()); UtilityTest.assertEqualsAndHash(pmap, HashTreePMap.from(pmap)); UtilityTest.assertEqualsAndHash(HashTreePMap.empty(), pmap.minusAll(pmap.keySet())); UtilityTest.assertEqualsAndHash(pmap, pmap.plusAll(pmap));
@JsonCreator public PlanNodeStatsEstimate( @JsonProperty("outputRowCount") double outputRowCount, @JsonProperty("symbolStatistics") Map<Symbol, SymbolStatsEstimate> symbolStatistics) { this(outputRowCount, HashTreePMap.from(requireNonNull(symbolStatistics, "symbolStatistics is null"))); }
@SuppressWarnings("unchecked") private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { try { Field entriesField = getClass().getDeclaredField("entries"); entriesField.setAccessible(true); entriesField.set(this, HashTreePMap.from((Map<K, V>) in.readObject())); } catch (IllegalAccessException | NoSuchFieldException e) { throw new IOException(e); } }
public static <K extends Term, V extends Term> ImmutableMapSubstitution<K, V> from(Map<K, V> map) { return map instanceof ImmutableMapSubstitution ? (ImmutableMapSubstitution<K, V>) map : new ImmutableMapSubstitution<>(HashTreePMap.from(map)); }
public static <K, V> PersistentMapX<K, V> fromMap(final Map<? extends K, ? extends V> map) { return new PMapXImpl<K, V>( HashTreePMap.from(map)); }
default Value of(Map<String, ? extends T> values) { return of(HashTreePMap.from(values)); } default Value of(String key1, T value1) {
@Override public PMap<String, V> applyUnsafe(JsonParser p) throws IOException { Map<String, V> values = new HashMap<>(); if (p.nextToken() == JsonToken.END_OBJECT) { return HashTreePMap.empty(); } while (p.nextValue() != JsonToken.END_OBJECT) { String fieldName = p.getCurrentName(); values.put(fieldName, valueDeserialiser.apply(p)); } return HashTreePMap.from(values); } }
@Override public PMap<String, T> applyUnsafe(BsonValue p) throws BsonInvalidOperationException { BsonDocument doc = p.asDocument(); Map<String, T> values = new HashMap<>(); for (Map.Entry<String,BsonValue> e : doc.entrySet()) { values.put(e.getKey(), valueDeserialiser.apply(e.getValue())); } return HashTreePMap.from(values); } }
public static Record of(Stream<Value> values) { /* * Collectors.toMap will call HashMap.merge() which will throw a NullPointerException if supplied with a null * for the value parameter, so filter out null values first. */ return new HashRecord(HashTreePMap.from(values.filter(v -> null != v.value()).collect(Collectors.toMap(Value::key, Value::value)))); }
public static <K, V> PMap<K, V> of(K key, V value) { return HashTreePMap.from(new Builder<K, V>(key, value).build()); } public static <K, V> PMap<K, V> of(K key, V value,K key1, V value1) {
@Inject public ConfigurationServiceLocator(Config config, CircuitBreakersPanel circuitBreakersPanel) { super(circuitBreakersPanel); Map<String, List<URI>> services = new HashMap<>(); if (config.hasPath(LAGOM_SERVICES_KEY)) { Config configServices = config.getConfig(LAGOM_SERVICES_KEY); for (String key : configServices.root().keySet()) { try { List<URI> uris = ConfigExtensions.getStringList(configServices, key) .stream() .map(URI::create) .collect(Collectors.toList()); services.put(key, uris); } catch (ConfigException.WrongType e) { throw new IllegalStateException( "Error loading configuration for " + getClass().getSimpleName() + ". " + "Expected lagom.services." + key + " to be a String or a List of Strings, but was " + configServices.getValue(key).valueType(), e); } catch (IllegalArgumentException e) { throw new IllegalStateException( "Error loading configuration for " + getClass().getSimpleName() + ". " + "Expected lagom.services." + key + " to be a URI, but it failed to parse", e); } } } this.services = HashTreePMap.from(services); }
public static <K, V> PMap<K, V> of(K key, V value,K key1, V value1) { return HashTreePMap.from(new Builder<K, V>(key, value).put(key1, value1).build()); } public static <K, V> PMap<K, V> of(K key, V value,K key1, V value1,K key2, V value2) {
public static <K, V> PMap<K, V> of(K key, V value,K key1, V value1,K key2, V value2) { return HashTreePMap.from(new Builder<K, V>(key, value).put(key, value, key1, value1, key2, value2).build()); } public static <K, V> PMap<K, V> of(K key, V value,K key1, V value1,K key2, V value2,K key3, V value3) {
public static <K, V> PMap<K, V> of(K key, V value,K key1, V value1,K key2, V value2,K key3, V value3) { return HashTreePMap.from(new Builder<K, V>(key, value).put(key, value, key1, value1, key2, value2,key3, value3).build()); }