當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。