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


Java ImmutablePair.of方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.tuple.ImmutablePair.of方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutablePair.of方法的具体用法?Java ImmutablePair.of怎么用?Java ImmutablePair.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.tuple.ImmutablePair的用法示例。


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

示例1: onAccept

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
public boolean onAccept(Event event) {
    Pair<String, Object> key = ImmutablePair.of(event.getName(), event.get(getAttributeName()));

    Cache<Pair<String, Object>, Boolean> cache = getCache();
    synchronized (cache) {
        boolean hasOccured = cache.getIfPresent(key) != null;

        if (!hasOccured) {
            cache.put(key, true);
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:16,代码来源:Deduplication.java

示例2: fail

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * Marks a message denoted by the id and sequence to have failed. This message is added for emission and will be
 * emitted on the next {@link BufferingSubscriber#receive()}.
 */
@Override
public void fail(String id, int sequence) {
    Pair<String, Integer> compositeID = ImmutablePair.of(id, sequence);
    PubSubMessage message = unCommittedMessages.get(compositeID);
    if (message != null) {
        receivedMessages.add(0, message);
        unCommittedMessages.remove(compositeID);
    }
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:16,代码来源:BufferingSubscriber.java

示例3: feedPair

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Pair<SyndFeed, List<SyndEntry>> feedPair(RufusFeed request) {
    SyndFeed feed = request.getFeed();
    return ImmutablePair.of(feed, feed.getEntries());
}
 
开发者ID:jtanza,项目名称:rufus,代码行数:6,代码来源:FeedProcessorImpl.java

示例4: putResult

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
public static synchronized void putResult(final Map<String, String> hyperParams,
        final int triedTimes, final float result) {
    final Pair<Map<String, String>, Integer> pair = ImmutablePair.of(hyperParams, triedTimes);
    mResults.put(pair, result);
}
 
开发者ID:chncwang,项目名称:laozhongyi,代码行数:6,代码来源:HyperParamResultManager.java

示例5: commit

import org.apache.commons.lang3.tuple.ImmutablePair; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * Marks a message as fully processed. This message is forgotten and cannot be failed after. If we have equal or
 * more than {@link #maxUncommitedMessages} uncommited messages, further calls to {@link #receive()} will return
 * nulls till some messages are commited.
 */
@Override
public void commit(String id, int sequence) {
    ImmutablePair<String, Integer> key = ImmutablePair.of(id, sequence);
    unCommittedMessages.remove(key);
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:13,代码来源:BufferingSubscriber.java


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