本文整理匯總了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;
}
}
}
示例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);
}
}
示例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());
}
示例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);
}
示例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);
}