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


Java Reduce类代码示例

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


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

示例1: getResult

import org.waveprotocol.wave.model.util.IdentityMap.Reduce; //导入依赖的package包/类
@Override
public R getResult() {
  Reduce<Object, R, R> aggregator = new Reduce<Object, R, R>() {
    @Override
    public R apply(R soFar, Object key, R item) {
      if (soFar != null) {
        throw new IllegalStateException("scope contains multiple renderings");
      } else {
        return item;
      }
    }
  };
  // Thread aggregator through the rendering maps, ensuring there is at most
  // one rendering in any of them.
  R rendering = null;
  rendering = result.getBlips().reduce(rendering, aggregator);
  rendering = result.getThreads().reduce(rendering, aggregator);
  rendering = result.getConversations().reduce(rendering, aggregator);
  rendering = result.getWaves().reduce(rendering, aggregator);
  return rendering;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:ReducingRendererHelper.java

示例2: getFirstConversation

import org.waveprotocol.wave.model.util.IdentityMap.Reduce; //导入依赖的package包/类
public UiBuilder getFirstConversation(IdentityMap<Conversation, UiBuilder> conversations) {
  return conversations.reduce(null, new Reduce<Conversation, UiBuilder, UiBuilder>() {
    @Override
    public UiBuilder apply(UiBuilder soFar, Conversation key, UiBuilder item) {
      // Pick the first rendering (any will do).
      return soFar == null ? item : soFar;
    }
  });
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:10,代码来源:MyFullDomRenderer.java

示例3: render

import org.waveprotocol.wave.model.util.IdentityMap.Reduce; //导入依赖的package包/类
@Override
public TopConversationView render(
    ConversationView wave, IdentityMap<Conversation, View> conversations) {
  // Pick the first one.
  return conversations.isEmpty() ? null :
    conversations.reduce(null,
      new Reduce<Conversation, View, TopConversationView>() {

        @Override
        public TopConversationView apply(
            TopConversationView soFar, Conversation key, View item) {
          return soFar != null ? soFar : (TopConversationView) item;
        }
      });
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:16,代码来源:FakeRenderer.java

示例4: getFirstConversation

import org.waveprotocol.wave.model.util.IdentityMap.Reduce; //导入依赖的package包/类
private UiBuilder getFirstConversation(IdentityMap<Conversation, UiBuilder> conversations) {
  return conversations.reduce(null, new Reduce<Conversation, UiBuilder, UiBuilder>() {
    @Override
    public UiBuilder apply(UiBuilder soFar, Conversation key, UiBuilder item) {
      // Pick the first rendering (any will do).
      return soFar == null ? item : soFar;
    }
  });
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:10,代码来源:FullDomRenderer.java

示例5: render

import org.waveprotocol.wave.model.util.IdentityMap.Reduce; //导入依赖的package包/类
@Override
public TopConversationView render(
    ConversationView wave, IdentityMap<Conversation, View> conversations) {
  // Pick the first one.
  return conversations.isEmpty() ? null :
    conversations.reduce(null, new Reduce<Conversation, View, TopConversationView>() {
      @Override
      public TopConversationView apply(TopConversationView soFar, Conversation key, View item) {
        return soFar != null ? soFar : (TopConversationView) item;
      }
    });
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:13,代码来源:FakeRenderer.java


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