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