本文整理汇总了Java中java.util.Deque.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java Deque.toArray方法的具体用法?Java Deque.toArray怎么用?Java Deque.toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Deque
的用法示例。
在下文中一共展示了Deque.toArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dequeStuff
import java.util.Deque; //导入方法依赖的package包/类
static void dequeStuff() {
Deque<Object> d = new ArrayDeque<>();
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.add(null);
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.addFirst(null);
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.addLast(null);
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.offerFirst(null);
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.offerLast(null);
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.offer(null);
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.push(null);
// BUG: Diagnostic contains: passing @Nullable parameter 'null' where @NonNull is required
d.toArray(null);
}
示例2: toStyleProcessor
import java.util.Deque; //导入方法依赖的package包/类
/**
* Return the style corresponding to the threshold value.
*/
protected Processor<SlaData> toStyleProcessor(final JiraSlaComputations slaComputations, final String styleNormal,
final String styleOver) {
return new Processor<SlaData>() {
@Override
public Object getValue(final Deque<Object> contextData) {
// Get the context
final Object[] context = contextData.toArray();
final SlaData data = (SlaData) contextData.getLast();
final int index = (Integer) context[context.length - 2];
final long threshold = slaComputations.getSlaConfigurations().get(index).getThreshold();
// Check the threshold
if (data != null && threshold != 0 && data.getDuration() > threshold) {
// Out of time
return styleOver;
}
return styleNormal;
}
};
}
示例3: getRootURLs
import java.util.Deque; //导入方法依赖的package包/类
@NonNull
private static URL[] getRootURLs(@NonNull final ClassPath cp) {
final List<ClassPath.Entry> entries = cp.entries();
final Deque<URL> res = new ArrayDeque<>(entries.size());
for (ClassPath.Entry e : entries) {
res.offer(e.getURL());
}
return res.toArray(new URL[res.size()]);
}