当前位置: 首页>>代码示例>>Java>>正文


Java Map类代码示例

本文整理汇总了Java中io.vavr.collection.Map的典型用法代码示例。如果您正苦于以下问题:Java Map类的具体用法?Java Map怎么用?Java Map使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Map类属于io.vavr.collection包,在下文中一共展示了Map类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ReduxFXView

import io.vavr.collection.Map; //导入依赖的package包/类
private ReduxFXView(
        ReduxFXStore<S> store,
        Function<S, VNode> view,
        Object javaFXRoot,
        Option<VNode> initialVNode) {
    final Flowable<Option<VNode>> vScenegraphStream =
            Flowable.fromPublisher(store)
                    .map(view::apply)
                    .map(Option::of)
                    .startWith(initialVNode);

    final Flowable<Map<VProperty.Phase, Vector<Patch>>> patchesStream =
            vScenegraphStream.zipWith(vScenegraphStream.skip(1), Differ::diff);

    final Flowable<PatchParams> paramsStream = vScenegraphStream.zipWith(patchesStream, PatchParams::new);

    paramsStream.forEach(
            params -> {
                if (Platform.isFxApplicationThread()) {
                    Patcher.patch(store::dispatch, javaFXRoot, params.vRoot, params.patches);
                } else {
                    Platform.runLater(() -> Patcher.patch(store::dispatch, javaFXRoot, params.vRoot, params.patches));
                }
            }
    );
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:27,代码来源:ReduxFXView.java

示例2: updateItem

import io.vavr.collection.Map; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void updateItem(Object data, boolean empty) {
    super.updateItem(data, empty);

    if (empty || data == null) {
        setText(null);
        setGraphic(null);
    } else {
        final Object item = mapping.apply(data);
        if (item instanceof VNode) {
            final VNode newVNode = VScenegraphFactory.customNode(ListCell.class).child("graphic", (VNode) item);
            final Option<VNode> oldVNode = Option.of(getGraphic()).flatMap(node -> Option.of((VNode) node.getUserData()));
            final Map<Phase, Vector<Patch>> patches = Differ.diff(oldVNode, Option.of(newVNode));
            Patcher.patch(dispatcher, this, oldVNode, patches);
            Option.of(getGraphic()).forEach(node -> node.setUserData(newVNode));
        } else {
            this.setText(String.valueOf(item));
            this.setGraphic(null);
        }
    }
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:23,代码来源:ListViewCellFactoryAccessor.java

示例3: diffAttributes

import io.vavr.collection.Map; //导入依赖的package包/类
private static Map<Phase, Vector<Patch>> diffAttributes(Vector<Object> path, VNode a, VNode b) {
    final Map<String, VProperty> removedProperties = a.getProperties().removeAll(b.getProperties().keySet()).map((key, value) -> Tuple.of(key, Factory.property(value.getPhase(), key)));
    final Map<String, VProperty> updatedProperties = b.getProperties().filter(propertyB -> !Option.of(propertyB._2).equals(a.getProperties().get(propertyB._1)));

    final Map<VEventType, Option<VEventHandler>> removedEventHandlers = a.getEventHandlers().removeAll(b.getEventHandlers().keySet()).map((key, value) -> Tuple.of(key, Option.none()));
    final Map<VEventType, Option<VEventHandler>> updatedEventHandlers = b.getEventHandlers().filter(handlerB -> !Objects.equals(Option.of(handlerB._2), a.getEventHandlers().get(handlerB._1))).map((key, value) -> Tuple.of(key, Option.of(value)));
    final Map<VEventType, Option<VEventHandler>> diffEventHandlers = removedEventHandlers.merge(updatedEventHandlers);

    return removedProperties.merge(updatedProperties)
            .groupBy(tuple -> tuple._2.getPhase())
            .map((phase, properties) ->
                    Tuple.of(phase, Vector.of(
                            new AttributesPatch(
                                    path,
                                    properties,
                                    phase == Phase.DEFAULT ? diffEventHandlers : HashMap.empty()
                            )
                    ))
            );
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:21,代码来源:Differ.java

示例4: fromJsonObject

import io.vavr.collection.Map; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
T fromJsonObject(JsonObject obj, Type type, Type[] subTypes, JsonDeserializationContext ctx) throws JsonParseException {
    Function<java.util.Map.Entry<String, JsonElement>, Tuple2<String, ?>> mapper;
    if (subTypes.length == 2) {
        mapper = e -> Tuple.of(ctx.deserialize(new JsonPrimitive(e.getKey()), subTypes[0]), ctx.deserialize(e.getValue(), subTypes[1]));
    } else {
        mapper = e -> Tuple.of(e.getKey(), e.getValue());
    }
    return (T) factory.apply(obj.entrySet().stream().map(mapper).collect(Collectors.toList()));
}
 
开发者ID:vavr-io,项目名称:vavr-gson,代码行数:12,代码来源:MapConverter.java

示例5: fromJsonObject

import io.vavr.collection.Map; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
T fromJsonObject(JsonObject obj, Type type, Type[] subTypes, JsonDeserializationContext ctx) throws JsonParseException {
    Function1<java.util.Map.Entry<String, JsonElement>, Stream<Tuple2<String, ?>>> mapper;
    if (subTypes.length == 2) {
        mapper = e -> StreamSupport.stream(e.getValue().getAsJsonArray().spliterator(), false).map(v -> Tuple.of(ctx.deserialize(new JsonPrimitive(e.getKey()), subTypes[0]), ctx.deserialize(v, subTypes[1])));
    } else {
        mapper = e -> StreamSupport.stream(e.getValue().getAsJsonArray().spliterator(), false).map(v -> Tuple.of(e.getKey(), v));
    }
    return (T) factory.apply(obj.entrySet().stream().flatMap(mapper).collect(Collectors.toList()));
}
 
开发者ID:vavr-io,项目名称:vavr-gson,代码行数:12,代码来源:MultimapConverter.java

示例6: FontAwesomeIconViewBuilder

import io.vavr.collection.Map; //导入依赖的package包/类
public FontAwesomeIconViewBuilder(Class<?> nodeClass,
                                  Map<String, Array<VNode>> childrenMap,
                                  Map<String, Option<VNode>> singleChildMap,
                           Map<String, VProperty> properties,
                           Map<VEventType, VEventHandler> eventHandlers) {
    super(nodeClass, childrenMap, singleChildMap, properties, eventHandlers);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:8,代码来源:FontAwesomeIconViewBuilder.java

示例7: apply

import io.vavr.collection.Map; //导入依赖的package包/类
/**
 * Returns a new ACL with the given change applied.
 */
public ACL<R,C> apply(C change) {
    for (UUID target: builder.getTargetId(change)) {
        Map<R,Set<UUID>> entries = this.entries;
        for (R granted: builder.getGranted(change)) {
            entries = entries.put(granted, entries.getOrElse(Tuple.of(granted, HashSet.empty()))._2.add(target));
        }
        for (R revoked: builder.getRevoked(change)) {
            entries = entries.put(revoked, entries.getOrElse(Tuple.of(revoked, HashSet.empty()))._2.remove(target));
        }
        return (entries.eq(this.entries)) ? this : new ACL<>(builder, entries);
    }
    
    return this;
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:18,代码来源:ACL.java

示例8: DC

import io.vavr.collection.Map; //导入依赖的package包/类
public DC(final String name, final int httpPort, Map<String,Integer> remotes) {
    this.name = name;
    config = ConfigFactory.parseMap(HashMap.<String,Object>
        of("clustering.port", clusteringPort)
        .put("clustering.seed-port", clusteringPort)
        .put("ts-reaktive.replication.local-datacenter.name", name)
        .put("ts-reaktive.replication.local-datacenter.host", "localhost")
        .put("ts-reaktive.replication.local-datacenter.port", httpPort)
        .put("ts-reaktive.replication.cassandra.keyspace", "replication_" + name)
        .put("cassandra-journal.port", CassandraLauncher.randomPort())
        .put("clustering.name", name)
        .put("cassandra-journal.keyspace", name) // each datacenter is in its own cassandra keyspace
        .merge(
            HashMap.ofEntries(remotes.map(r -> Tuple.of("ts-reaktive.replication.remote-datacenters." + r._1 + ".url", "ws://localhost:" + r._2)))
        )
        .toJavaMap()
        ).withFallback(ConfigFactory.parseResources("com/tradeshift/reaktive/replication/ReplicationIntegrationSpec.conf")).withFallback(ConfigFactory.defaultReference()).resolve();
    
    system = ActorSystem.create(config.getString("clustering.name"), config);
    shardRegion = ReplicatedTestActor.sharding.shardRegion(system);
    
    new AkkaPersistence(system).awaitPersistenceInit();
    
    try {
        System.out.println("*** AWAITING");
        Replication.get(system).start(TestEvent.class, shardRegion).toCompletableFuture().get(30, TimeUnit.SECONDS);
        System.out.println("*** DONE");
    } catch (InterruptedException | ExecutionException | TimeoutException e) {
        throw new RuntimeException(e);
    }
    
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:33,代码来源:ReplicationIntegrationSpec.java

示例9: WeatherIconViewBuilder

import io.vavr.collection.Map; //导入依赖的package包/类
public WeatherIconViewBuilder(Class<?> nodeClass,
                              Map<String, Array<VNode>> childrenMap,
                              Map<String, Option<VNode>> singleChildMap,
                              Map<String, VProperty> properties,
                              Map<VEventType, VEventHandler> eventHandlers) {
    super(nodeClass, childrenMap, singleChildMap, properties, eventHandlers);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:8,代码来源:WeatherIconViewBuilder.java

示例10: create

import io.vavr.collection.Map; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected B create(
        Map<String, Array<VNode>> childrenMap,
        Map<String, Option<VNode>> singleChildMap,
        Map<String, VProperty> properties,
        Map<VEventType, VEventHandler> eventHandlers) {
    return (B) new ToggleButtonBuilder<>(getNodeClass(), childrenMap, singleChildMap, properties, eventHandlers);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:10,代码来源:ToggleButtonBuilder.java

示例11: ListViewBuilder

import io.vavr.collection.Map; //导入依赖的package包/类
public ListViewBuilder(Class<?> nodeClass,
                       Class<T> elementClass,
                       Map<String, Array<VNode>> childrenMap,
                       Map<String, Option<VNode>> singleChildMap,
                       Map<String, VProperty> properties,
                       Map<VEventType, VEventHandler> eventHandlers) {
    super(nodeClass, childrenMap, singleChildMap, properties, eventHandlers);
    this.elementClass = elementClass;
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:10,代码来源:ListViewBuilder.java

示例12: create

import io.vavr.collection.Map; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected B create(
        Map<String, Array<VNode>> childrenMap,
        Map<String, Option<VNode>> singleChildMap,
        Map<String, VProperty> properties,
        Map<VEventType, VEventHandler> eventHandlers) {
    return (B) new ColorChooserBuilder<>(getNodeClass(), childrenMap, singleChildMap, properties, eventHandlers);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:10,代码来源:ColorChooserBuilder.java

示例13: create

import io.vavr.collection.Map; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected B create(
        Map<String, Array<VNode>> childrenMap,
        Map<String, Option<VNode>> singleChildMap,
        Map<String, VProperty> properties,
        Map<VEventType, VEventHandler> eventHandlers) {
    return (B) new MaterialDesignIconViewBuilder<>(getNodeClass(), childrenMap, singleChildMap, properties, eventHandlers);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:10,代码来源:MaterialDesignIconViewBuilder.java

示例14: MenuBarBuilder

import io.vavr.collection.Map; //导入依赖的package包/类
public MenuBarBuilder(Class<?> nodeClass,
                      Map<String, Array<VNode>> childrenMap,
                      Map<String, Option<VNode>> singleChildMap,
                      Map<String, VProperty> properties,
                      Map<VEventType, VEventHandler> eventHandlers) {
    super(nodeClass, childrenMap, singleChildMap, properties, eventHandlers);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:8,代码来源:MenuBarBuilder.java

示例15: JFXTextFieldBuilder

import io.vavr.collection.Map; //导入依赖的package包/类
public JFXTextFieldBuilder(Class<?> nodeClass,
                           Map<String, Array<VNode>> childrenMap,
                           Map<String, Option<VNode>> singleChildMap,
                           Map<String, VProperty> properties,
                           Map<VEventType, VEventHandler> eventHandlers) {
    super(nodeClass, childrenMap, singleChildMap, properties, eventHandlers);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:8,代码来源:JFXTextFieldBuilder.java


注:本文中的io.vavr.collection.Map类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。