本文整理汇总了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);
}