@Override public java.util.HashMap<K, V> toJavaMap() { return toJavaMap(java.util.HashMap::new, t -> t); }
@Override public java.util.HashMap<K, V> toJavaMap() { return toJavaMap(java.util.HashMap::new, t -> t); }
"page", request.queryParam("page").orElse("0"), "per_page", request.queryParam("size").orElse("3") ).toJavaMap()
Session initializeSession(final String keyspaceName) { final Session s = this.cluster.connect(); // if the keyspace already exists, just return the session if (this.cluster.getMetadata().getKeyspace(keyspaceName) != null) { return s; } final Configuration configuration = getStorageConfig(); // Setting replication strategy based on value reading from the configuration: either "SimpleStrategy" or "NetworkTopologyStrategy" final Map<String, Object> replication = Match(configuration.get(REPLICATION_STRATEGY)).of( Case($("SimpleStrategy"), strategy -> HashMap.<String, Object> of("class", strategy, "replication_factor", configuration.get(REPLICATION_FACTOR))), Case($("NetworkTopologyStrategy"), strategy -> HashMap.<String, Object> of("class", strategy) .merge(Array.of(configuration.get(REPLICATION_OPTIONS)) .grouped(2) .toMap(array -> Tuple.of(array.get(0), Integer.parseInt(array.get(1))))))) .toJavaMap(); s.execute(createKeyspace(keyspaceName) .ifNotExists() .with() .replication(replication)); return s; }
@Test public void testWithOption() throws Exception { Multimap<String, Option<Integer>> multimap = this.<String, Option<Integer>>emptyMap().put("1", Option.some(1)).put("1", Option.none()); String json = genJsonMap(HashMap.of("1", asList(1, null)).toJavaMap()); verifySerialization(typeReferenceWithOption(), io.vavr.collection.List.of(Tuple.of(multimap, json))); } }